public void IsRunning_ShouldBe_Origin_IsRunning(bool value) { // Arrange _origin.IsRunning().Returns(value); var subject = new SafeService(_origin); // Act var result = subject.IsRunning(); // Assert result.Should().Be(value); }
public void IsRunning_ShouldPass_NotExpectedException() { // Arrange var exception = new Exception(); _origin.IsRunning().Throws(exception); var subject = new SafeService(_origin); // Act Action action = () => subject.IsRunning(); // Assert action.Should().ThrowExactly <Exception>(); }
public void IsRunning_ShouldBeFalse_WhenOriginThrows_ExpectedException(Type exceptionType) { // Arrange var exception = (Exception)Activator.CreateInstance(exceptionType); _origin.IsRunning().Throws(exception); var subject = new SafeService(_origin); // Act var result = subject.IsRunning(); // Assert result.Should().BeFalse(); }