public void TestA() { Mock <IServiceA> serviceA = new Mock <IServiceA>(); var value = "ABC"; serviceA.Setup(s => s.ReturnValue(It.IsAny <string>())).Returns(value); var serviceB = new ServiceB(serviceA.Object); serviceB.returnValue(true, value); serviceA.Verify(mock => mock.ReturnValue(It.IsAny <string>()), Times.Once()); }
public void TestB() { Mock <IServiceA> serviceA = new Mock <IServiceA>(); var value = "ABC"; serviceA.Setup(s => s.ReturnValue(It.IsAny <string>())).Returns("ABCDEF"); var serviceB = new ServiceB(serviceA.Object); serviceB.returnValue(false, value); serviceA.Verify(mock => mock.ReturnValue(It.IsAny <string>()), Times.Never()); }