Пример #1
0
        public void ReceiveOrSendImmediately_GivenPreparationIsNotImmediate_JustThrowsTheException()
        {
            // Arrange
            preparationInlet.Setup(p => p.SendImmediately(It.IsAny <string>())).Throws <InvalidOperationException>();

            // Act
            InvalidOperationException exception = null;

            try
            {
                valve.ReceiveOrSendImmediately("Not gonna make it...");
            }
            catch (InvalidOperationException e)
            {
                exception = e;
            }

            // Assert
            preparationInlet.Verify(p => p.SendImmediately(It.IsAny <string>()), Times.Once);
            resultOutlet.Verify(r => r.ReceiveImmediately(), Times.Never);
            exception.Should().NotBeNull();
        }