Hide object members on fluent API interfaces
See original GitHub issueA 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:
- Created 7 years ago
- Comments:12 (12 by maintainers)
Top GitHub Comments
It’s not a fluent interface, so I don’t see any reason to hide object members.
This issue has been released in FakeItEasy 3.0.0: https://github.com/FakeItEasy/FakeItEasy/releases/3.0.0