Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

FakeItEasy.FluentAssertions package #72

Open
danielmarbach opened this Issue · 14 comments

5 participants

@danielmarbach

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:

A.CallTo().Should().HaveHappened().And.ExactlyOnce()

This would also help to spread the usage of FluentAssertions

@adamralph
Owner

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.

@patrik-hagne
Owner

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);

@adamralph
Owner

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.

@danielmarbach
@danielmarbach
@patrik-hagne
Owner

I agree, as separate package/packages this would be great. Just out of curiosity, I would still like to know the benefit.

@danielmarbach
@dennisdoomen

Awesome idea!

@adamralph
Owner

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.

@danielmarbach

@adamralph I can do it but not before christmas. I'm currently maintaining other OS stuff which keeps me extremely busy. Sorry

@adamralph
Owner

@danielmarbach I know how you feel :wink:

@dennisdoomen

If I had any time next to my day job, my kids and the next few releases of FluentAssertions, I would help you....

@danielmarbach
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.