public static void Main()
        {
            var externalService = new ExternalService();

            var circuitBreaker = new CircuitBreaker(
                TaskScheduler.Default,
                maxFailures: 2,
                invocationTimeout: TimeSpan.FromMilliseconds(10),
                circuitResetTimeout: TimeSpan.FromMilliseconds(1000));

            TryExecute(circuitBreaker, externalService.Get);
            TryExecute(circuitBreaker, () => Thread.Sleep(100));
            TryExecute(circuitBreaker, externalService.Get);
        }
        public static void Main()
        {
            var externalService = new ExternalService();

            var circuitBreaker = new CircuitBreaker(
                TaskScheduler.Default,
                maxFailures: 2,
                invocationTimeout: TimeSpan.FromMilliseconds(10),
                circuitResetTimeout: TimeSpan.FromMilliseconds(1000));

            TryExecute(circuitBreaker, externalService.Get);
            TryExecute(circuitBreaker, () => Thread.Sleep(100));
            TryExecute(circuitBreaker, externalService.Get);

            TryExecuteAsync(circuitBreaker, externalService.GetAsync).Wait();
            TryExecuteAsync(circuitBreaker, () => Task.Delay(100)).Wait();
            TryExecuteAsync(circuitBreaker, externalService.GetAsync).Wait();
        }