public void Do_GivenServiceCallResultFalse_ThrowsException() { // arrange var service = new Mock <IService>(); service.Setup(x => x.ServiceCall()).Returns(false); var sut = new ClassWithDependencies(service.Object); // act // assert Assert.Throws <Exception>(() => sut.Do()); }
public void Do_GivenServiceCallResultTrue_DoesNotThrowException() { // arrange var service = new Mock <IService>(); service.Setup(x => x.ServiceCall()).Returns(true); var sut = new ClassWithDependencies(service.Object); // act sut.Do(); // assert service.Verify(x => x.ServiceCall(), Times.Once); }