示例#1
0
        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);
        }
示例#2
0
        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>();
        }
示例#3
0
        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();
        }