Maybe this is too much overhead for a simple benefit but I'm dumping it here anyway as an idea. Just thought it might be cool to support fluent assertions which would allow to use their exception and assertion model. The one could use:
This would also help to spread the usage of FluentAssertions
This is interesting. I'm an avid FluentAssertions fan myself.
Are you suggesting that we use some underlying part of the FluentAssertions SDK to achieve this? If so, I guess we could have a separate package named FakeItEasy.FluentAssertions for people to opt into. Otherwise we could just implement these fluent alternatives ourselves.
Do you mean like this:
A.CallTo(() => foo.Bar()).Should().HaveHappened().And.ExactlyOnce();
Would that be equivalent to:
A.CallTo(() => foo.Bar()).MustHaveHappened(Repeated.Exactly.Once)
If these are equivalent I don't really see the benefit but that might just be me. If we provide it as a separate package I'm all for it.
I actually had something similar working way back when. I had it playing nice with the NUnit-assertions, like this:
Assert.That(A.CallTo(() => foo.Bar()), Happened.Exactly.Once);
I suppose we could potentially have FakeItEasy.FluentAssertions, FakeItEasy.NUnit, FakeItEasy.XUnit, etc. If the community feels motivated to contribute these extensions then I'm more than happy to help out.
I think they should probably just exist as new assemblies in the current solution, with a separate NuGet package for each.
I agree, as separate package/packages this would be great. Just out of curiosity, I would still like to know the benefit.
I'm all for this. @danielmarbach if you want to start the ball rolling and add a FakeItEasy.FluentAssertions project to the solution, with perhaps an implementation of the first assertion method, then please go ahead.
@adamralph I can do it but not before christmas. I'm currently maintaining other OS stuff which keeps me extremely busy. Sorry
@danielmarbach I know how you feel 😉
If I had any time next to my day job, my kids and the next few releases of FluentAssertions, I would help you....