Describe<Adder>(() =>
{
// Expected behaviour
It("appends to history", () =>
{
OperationHistory history = new OperationHistory();
Spy historySpy = Jaz.SpyOn(history, nameof(history.Append));
var adder = new Adder(history);
adder.Add(-1, 1);
Expect(historySpy).ToHaveBeenCalled();
});
});
OperationHistory implements IOperationHistory. If Adder uses IoC (with an injected IOperationHistory rather than OperationHistory), the spy will not work:
OperationHistory implements IOperationHistory. If Adder uses IoC (with an injected IOperationHistory rather than OperationHistory), the spy will not work:
See attached. LM.JazSharp.Examples-2.zip