示例#1
0
        public void GetStoreFromFactory()
        {
            var store = CircuitBreakerStateStoreFactory.GetCircuitBreakerStateStore();

            Assert.IsAssignableFrom <ICircuitBreakerStateStore>(store);
            Assert.NotNull(store);
        }
示例#2
0
        public CircuitSwitchTests()
        {
            ICircuitBreakerStateStore circuitBreakerStateStore = CircuitBreakerStateStoreFactory.GetCircuitBreakerStateStore();
            IEventLogger eventLogger = new EventLogger();

            circuitBreaker = new CircuitBreaker(circuitBreakerStateStore, eventLogger);

            failingAction  = () => { throw new Exception(); };
            secondryAction = () => { Console.WriteLine("Nothing to see here"); };

            sut = new CircuitSwitch(circuitBreaker, eventLogger);
        }
示例#3
0
        public CircuitSwitchIntegrationTests()
        {
            ICircuitBreakerStateStore circuitBreakerStateStore = CircuitBreakerStateStoreFactory.GetCircuitBreakerStateStore();
            IEventLogger eventLogger = new EventLogger();

            circuitBreaker = new CircuitBreaker(circuitBreakerStateStore, eventLogger);

            sut = new CircuitSwitch(circuitBreaker, eventLogger);

            var conn = ConnectionMultiplexer.Connect("localhost");

            redisService     = (IDummyService) new RedisParameterCachingService(conn);
            dummyServiceMock = new Mock <IDummyService>();
        }
        public CircuitBreakerTests()
        {
            var eventLoggerMock = new Mock <IEventLogger>().Object;

            sut = (ICircuitBreaker) new CircuitBreaker(CircuitBreakerStateStoreFactory.GetCircuitBreakerStateStore(), eventLoggerMock);
        }