Esempio n. 1
0
        public void Running_ShouldBe_Origin_Running(bool value)
        {
            // Arrange
            _origin.Running().Returns(value);
            var subject = new SafeService(_origin);

            // Act
            var result = subject.Running();

            // Assert
            result.Should().Be(value);
        }
Esempio n. 2
0
        public void Running_ShouldPass_NotExpectedException()
        {
            // Arrange
            var exception = new Exception();

            _origin.Running().Throws(exception);
            var subject = new SafeService(_origin);

            // Act
            Action action = () => subject.Running();

            // Assert
            action.Should().ThrowExactly <Exception>();
        }
Esempio n. 3
0
        public void Running_ShouldBeFalse_WhenOriginThrows_ExpectedException(Type exceptionType)
        {
            // Arrange
            var exception = (Exception)Activator.CreateInstance(exceptionType);

            _origin.Running().Throws(exception);
            var subject = new SafeService(_origin);

            // Act
            var result = subject.Running();

            // Assert
            result.Should().BeFalse();
        }