Similar to this question about NSubstitute, I want to know if one is able to implement partial mocks using the FakeItEasy library.
FakeItEasy seems to have an overall nicer syntax than moq (like the strongly-typed way the former deals with passing parameters to a constructor of a faked class). I'm thinking about switching to FakeItEasy, but I really need partial mock support.
Yes. Syntax is no different than regular fake:
var fake = A.Fake<Fake>();
A.CallTo(() => fake.SomeMethod()).CallBaseMethod();
Or, to override all calls with base calls:
var fake = A.Fake<Fake>();
A.CallTo(fake).CallBaseMethod();
Edit Just to make clear: the fake object must be created over a concrete class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With