question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hide object members on fluent API interfaces

See original GitHub issue

A number of types don’t hide object members. Here are the public non-static types that don’t:

  • FakeItEasy.ArgumentValueFormatter`1[T]
  • FakeItEasy.Configuration.ArgumentCollection
  • FakeItEasy.Configuration.FakeConfigurationException
  • FakeItEasy.Configuration.IDoNothingConfiguration`1[TInterface]
  • FakeItEasy.Configuration.IOutAndRefParametersConfiguration`1[TInterface]
  • FakeItEasy.Configuration.IRepeatSpecification
  • FakeItEasy.Core.FakeCreationException
  • FakeItEasy.Core.FakeManager
  • FakeItEasy.Core.ICompletedFakeObjectCall
  • FakeItEasy.Core.IFakeObjectCall
  • FakeItEasy.Core.IFakeObjectCallRule
  • FakeItEasy.Core.IInterceptedFakeObjectCall
  • FakeItEasy.Core.IInterceptionListener
  • FakeItEasy.Core.Raise`1[TEventArgs]
  • FakeItEasy.Creation.ITaggable
  • FakeItEasy.DefaultBootstrapper
  • FakeItEasy.DummyFactory`1[T]
  • FakeItEasy.ExpectationException
  • FakeItEasy.FakeAttribute
  • FakeItEasy.FakeOptionsBuilder`1[TFake]
  • FakeItEasy.IArgumentValueFormatter
  • FakeItEasy.IBootstrapper
  • FakeItEasy.IDummyFactory
  • FakeItEasy.IFakeOptionsBuilder
  • FakeItEasy.IHideObjectMembers
  • FakeItEasy.IOutputWriter
  • FakeItEasy.Priority
  • FakeItEasy.Repeated
  • FakeItEasy.SelfInitializedFakes.CallData
  • FakeItEasy.SelfInitializedFakes.ICallStorage
  • FakeItEasy.SelfInitializedFakes.ISelfInitializingFakeRecorder
  • FakeItEasy.SelfInitializedFakes.RecordingException
  • FakeItEasy.SelfInitializedFakes.RecordingManager
  • FakeItEasy.UnderTestAttribute
  • FakeItEasy.Configuration.IWhereConfiguration`1[TInterface]

It’s arguable that none of these need to expose the object members, but it’s probably not harmful for most of them. The ones that define in the fluent API should hide object members.

I’d like to update a number of types before we release 3.0. And I think we should add an automated test to ensure that we don’t accidentally forget to hide the object members on new types. I’d probably put this in the Approval test project, but am happy to go along with ideas for another location.

I think a whitelist of types that don’t need to implement IHideObjectMembers is safest, so I’d put a list of exceptions in the test, and we’d filter candidate types against it. Assuming everyone’s on board, do you have any opinions on whether we apply the test to:

  • exported non-static types,
  • exported interfaces (because I think any of the types we have to worry about are actually exposed as interfaces), or
  • exported interfaces whose name ends in “Configuration” or “Specification” (I think all the fluent API members meet this restriction)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
thomaslevesquecommented, Dec 12, 2016

what do you think about IFakeObjectCall?

It’s not a fluent interface, so I don’t see any reason to hide object members.

0reactions
blairconradcommented, Feb 22, 2017

This issue has been released in FakeItEasy 3.0.0: https://github.com/FakeItEasy/FakeItEasy/releases/3.0.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fluent Interface - How to hide members (property setters) if ...
I am taking a stab at writing a fluent API in C#. What I am trying to do is make a builder that...
Read more >
Hide /remove gettype(), gethashcode(), equals and fluent ...
I try to hide `GetType()`, `GetHashCode()`, `Equals(object obj)` from fluent api and want a order sequence for api function
Read more >
Fluent API - Configuring and Mapping Properties and Types
This article is designed to demonstrate how to use the fluent API to configure properties. The code first fluent API is most commonly ......
Read more >
kzu/IFluentInterface: Clean, uncluttered fluent APIs in .NET
Object members : Full Intellisense. A much cleaner intellisense is possible though, by simply inheriting your fluent API interfaces from the IFluentInterface ...
Read more >
Implementing a Fluent Interface
Here's how to implement a fluent API for a single class that supports the goals of fluent interfaces.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found