Using FakeItEasy, I have a setup similar to the one below in one of my tests, and the CallTo
assertion at the bottom is failing when setup like this.
var fakedTool = A.Fake<ITool>();
var concreteUnderTest = new Concrete(fakedTool);
concreteUnderTest.doSomething();
var fooConstraint = A<Foo>.That.Matches(f => f.Name.Equals('Alice'));
var barConstraint = A<Bar>.Ignored;
A.CallTo(() => fakedTool.ObservedFunction(fooConstraint , barConstraint))
.MustHaveHappened(Repeated.Exactly.Once);
I have placed a breakpoint directly above the CallTo
line, and the values of fooConstraint
and barConstraint
are both null
.
When I set the assertion up like this, however, it passes:
A.CallTo(() =>
fakedTool.ObservedFunction(
A<Foo>.That.Matches(f => f.Name.Equals('Alice')),
A<Bar>.Ignored
)
).MustHaveHappened(Repeated.Exactly.Once);
What is causing this behaviour? Is it intended?