Add a FakeItEasy.FSharp package
See original GitHub issueSpun off from https://github.com/FakeItEasy/FakeItEasy/issues/229#issuecomment-31921208
Will include similar extensions to http://trelford.com/blog/post/MoqEx.aspx
More examples:
//C#
A.CallTo(() => comparer.Compare(
A<string>._,
A<string>.That.Matches(s => s == "must be equal to this"))).Returns(-1);
//F#
A.CallTo(fun () -> comparer.Compare(ignored(), is((=) "must be equal to this"))).Returns(-1)
//C#
A.CallTo(() => factory.Create()).Returns(A.Fake<IWidget>());
//F#
A.CallTo(fun () -> factory.Create()).Returns(fake())
We should add a FakeItEasy.FSharp
project to FakeItEasy.sln and ensure it gets built, packaged and released along with the other projects.
As for testing, an acceptance test project is probably enough. I don’t think unit tests would add much value.
The test project layout and naming convention is a little messy right now. What is under the Integration Tests
solution folder right now is generally anything that is not unit tests. Perhaps the test project should be Integration Tests\FakeItEasy.FSharp.Tests.Acceptance
.
I’ve no idea what test framework would be suitable for F#. Currently we use NUnit (which we’re considering replacing with xunit.net) and MSpec.
Issue Analytics
- State:
- Created 10 years ago
- Reactions:1
- Comments:9 (8 by maintainers)
Top GitHub Comments
Alternative implementation, a bit more complete, and more idiomatic:
Usage:
OK, apparently my approach isn’t perfect yet…
A.CallTo(<@ foo.VoidMethod() @>)
still picks the overload withQuotations.Expr<'a>
(where'a
isunit
; F# doesn’t really have the notion ofvoid
). So we would need a method with a different name for configuring void methods, which is annoying… In this case, there’s no real point in using methods rather than functions, since the whole point was to allow overloads.