Am I correct in saying that when using the AutoMocking container to assert a call on a dependency, you *have* to create some form of expectation which is then asserted (e.g. with AssertAll), rather than just defining the assertion at the end?
For example, the following works:
[TestMethod]
public void Test()
{
var c = new MockingContainer<Target>();
c.Arrange<ITargetDependency>(x => x.ShouldBeCalled());
c.Instance.WorkYourMagic();
c.AssertAll(); // will fail if WorkYourMagic does not call ITargetDependency.ShouldBeCalled()
}
However, this does not...
[TestMethod]
public void Test()
{
var c = new MockingContainer<Target>();
c.Instance.WorkYourMagic();
c.Assert<ITargetDependency>(x => x.ShouldBeCalled()); // Always claims WorkYourMagic does not call ITargetDependency.ShouldBeCalled()
}
Regards,
Nick
For example, the following works:
[TestMethod]
public void Test()
{
var c = new MockingContainer<Target>();
c.Arrange<ITargetDependency>(x => x.ShouldBeCalled());
c.Instance.WorkYourMagic();
c.AssertAll(); // will fail if WorkYourMagic does not call ITargetDependency.ShouldBeCalled()
}
However, this does not...
[TestMethod]
public void Test()
{
var c = new MockingContainer<Target>();
c.Instance.WorkYourMagic();
c.Assert<ITargetDependency>(x => x.ShouldBeCalled()); // Always claims WorkYourMagic does not call ITargetDependency.ShouldBeCalled()
}
Regards,
Nick