protected override void Given()
 {
     base.Given();
     _thrownException = new ArgumentNullException();
     _config = new CircuitBreakerConfig();
     _circuitBreaker = new CircuitBreaker(_config);
 }
 protected override void Given()
 {
     base.Given();
     _config = new CircuitBreakerConfig();
     _circuitBreaker = new CircuitBreaker(_config);
     _circuitBreaker.TryingToCloseCircuitBreaker += (sender, args) => _tryingToCloseFired = true;
 }
 protected override void Given()
 {
     base.Given();
     _caughtExceptions = new List<Exception>();
     _config = new CircuitBreakerConfig {ExpectedExceptionListType = ExceptionListType.BlackList};
     _config.ExpectedExceptionList.Add(typeof(ArgumentNullException));
     _circuitBreaker = new CircuitBreaker(_config);
     _circuitBreaker.ToleratedOpenCircuitBreaker += (sender, args) => _toleratedOpenEventFired = true;
     _thrownException = new NullReferenceException();
 }
 protected override void Given()
 {
     base.Given();
     _config = new CircuitBreakerConfig
     {
         ExpectedExceptionListType = ExceptionListType.BlackList
     };
     _config.ExpectedExceptionList.Add(typeof(ArgumentNullException));
     _circuitBreaker = new CircuitBreaker(_config);
     _thrownException = new NullReferenceException();
 }
 protected override void Given()
 {
     base.Given();
     _timeout = TimeSpan.FromSeconds(10);
     _config = new CircuitBreakerConfig
     {
         UseTimeout = true,
         Timeout = _timeout
     };
     _circuitBreaker = new CircuitBreaker(_config);
 }
 protected override void Given()
 {
     base.Given();
     _thrownException = new ArgumentNullException();
     _config = new CircuitBreakerConfig
     {
         Timeout = TimeSpan.FromMilliseconds(1000),
         UseTimeout = true
     };
     _circuitBreaker = new CircuitBreaker(_config);
 }
 protected override void Given()
 {
     base.Given();
     _config = new CircuitBreakerConfig
     {
         ExpectedExceptionListType = ExceptionListType.BlackList,
         PermittedExceptionPassThrough = PermittedExceptionBehaviour.Swallow
     };
     _config.ExpectedExceptionList.Add(typeof(ArgumentNullException));
     _circuitBreaker = new CircuitBreaker(_config);
     _thrownException = new NullReferenceException();
 }
 protected override void Given()
 {
     base.Given();
     _caughtExceptions = new List<Exception>();
     _thrownException = new ArgumentNullException();
     _config = new CircuitBreakerConfig
     {
         OpenEventTolerance = 2
     };
     _circuitBreaker = new CircuitBreaker(_config);
     _circuitBreaker.ToleratedOpenCircuitBreaker += (sender, args) => _toleratedOpenEventCount++;
 }
 protected override void Given()
 {
     base.Given();
     _config = new CircuitBreakerConfig
     {
         BreakerOpenPeriods = new[] {TimeSpan.FromSeconds(1)}
     };
     _circuitBreaker = new CircuitBreaker(_config);
     _circuitBreaker.OpenedCircuitBreaker += (sender, args) => _breakerOpenedCount++;
     _circuitBreaker.TryingToCloseCircuitBreaker += (sender, args) => _breakerTryingToCloseCount++;
     _circuitBreaker.ClosedCircuitBreaker += (sender, args) => _breakerClosedCount++;
 }
        protected override void Given()
        {
            base.Given();
            _config = new CircuitBreakerConfig
            {
                ExpectedExceptionListType = ExceptionListType.BlackList,
                ExpectedExceptionList = new List<Type> { typeof (IndexOutOfRangeException) },
                OpenEventTolerance = 5,
            };

            _circuitBreaker = new CircuitBreaker(_config) { State = BreakerState.Open };
            _circuitBreaker.ClosedCircuitBreaker += (sender, args) => _closedEventFired = true;
        }
 protected override void Given()
 {
     base.Given();
     _caughtExceptions = new List<Exception>();
     _thrownException = new ArgumentNullException();
     _config = new CircuitBreakerConfig
     {
         Timeout = TimeSpan.FromMilliseconds(1000),
         UseTimeout = true,
         OpenEventTolerance = 2
     };
     _circuitBreaker = new CircuitBreaker(_config);
     _circuitBreaker.ToleratedOpenCircuitBreaker += (sender, args) => _toleratedOpenedCount++;
 }
        protected override void Given()
        {
            base.Given();
            _caughtExceptions = new List<Exception>();
            _config = new CircuitBreakerConfig
            {
                UseTimeout = true,
                Timeout = TimeSpan.FromMilliseconds(0),
                OpenEventTolerance = 2
            };

            _circuitBreaker = new CircuitBreaker(_config);
            _circuitBreaker.OpenedCircuitBreaker += (sender, args) => _openedEventFired = true;
            _circuitBreaker.ToleratedOpenCircuitBreaker += (sender, args) => _toleratedOpenedCount++;
        }
        protected override void Given()
        {
            base.Given();
            _config = new CircuitBreakerConfig
            {
                ExpectedExceptionListType = ExceptionListType.BlackList,
                ExpectedExceptionList = new List<Type> { typeof (IndexOutOfRangeException) },
                OpenEventTolerance = 5,
            };

            _circuitBreaker = new CircuitBreaker(_config);
            _circuitBreaker.OpenedCircuitBreaker += (sender, args) => _openedEventCount++;
            _circuitBreaker.ToleratedOpenCircuitBreaker += (sender, args) => _toleratedOpenedEventFired = true;
            _thrownException = new IndexOutOfRangeException();
            _circuitBreaker.State = BreakerState.Open;
        }
        protected override void Given()
        {
            base.Given();
            _config = new CircuitBreakerConfig
            {
                ExpectedExceptionListType = ExceptionListType.WhiteList,
                ExpectedExceptionList = new List<Type> { typeof (IndexOutOfRangeException) },
                OpenEventTolerance = 5,
                UseTimeout = true,
                Timeout = TimeSpan.FromSeconds(10),
            };

            _circuitBreaker = new CircuitBreaker(_config);
            _circuitBreaker.ClosedCircuitBreaker += (sender, args) => _closedEventCount++;
            _thrownException = new IndexOutOfRangeException();

            _circuitBreaker.State = BreakerState.Open;
        }
 protected override void Given()
 {
     base.Given();
     _config = new CircuitBreakerConfig();
     _circuitBreaker = new CircuitBreaker(_config);
 }