コード例 #1
0
        public void GivenCircuitBreaker_WhenFailure_ThenLastExceptionIsKept()
        {
            // Arrange
            Action protectedCode  = () => { throw new Exception("Message"); };
            var    circuitBreaker = new BaseCircuitBreaker.CircuitBreaker(10, TimeSpan.FromMinutes(5));

            // Act
            circuitBreaker.AttemptCall(protectedCode);

            // Assert
            Assert.Equal("Message", circuitBreaker.GetExceptionFromLastAttemptCall().Message);
        }