I would like to reset a Fake Calls History or ignore a Call.
The fake asserted method is called in the Init method in the tested class constructor and I want to ignore this call because it's not part of the tested action.
Here an example:
[TestClass]
public class UnitTest1
{
private MyFakedClass myFakedObject;
private SUT sut;
[TestInitialize]
public void Init()
{
myFakedObject = A.Fake<MyFakedClass>();
sut = new SUT(myFakedObject); //constructor calls myFakedObject.AssertedMethod()
}
[TestMethod]
public void TestMethod1()
{
sut.TestedMethod(); //TestedMethod calls myFakedObject.AssertedMethod() again...
A.CallTo(() => myFakedObject.AssertedMethod()).MustHaveHappened(Repeated.Exactly.Once);
//...So this is false
}
}