public void When_retrying_a_task_that_always_fails_on_multiple_exceptions()
        {
            var counter = 0;

            var retryEx = Should.Throw <RetryException>(async() =>
            {
                await Retry.OnAny <ArgumentNullException, NullReferenceException>(() => {
                    counter++;
                    throw new NullReferenceException();
                });
            });

            retryEx.RetryCount.ShouldBe((uint)1);
            retryEx.Message.ShouldBe("Retry failed after: 1 attempts.");

            counter.ShouldBe(2);

            counter = 0;

            retryEx = Should.Throw <RetryException>(async() =>
            {
                await Retry.OnAny <ArgumentNullException, NullReferenceException>(() => {
                    counter++;
                    throw new NullReferenceException();
                },
                                                                                  100.Milliseconds(),
                                                                                  100.Milliseconds(),
                                                                                  100.Milliseconds());
            });
            retryEx.RetryCount.ShouldBe((uint)3);
            retryEx.Message.ShouldBe("Retry failed after: 3 attempts.");

            counter.ShouldBe(4);
        }
        public void When_retrying_a_task_that_does_not_fail_on_multiple_exceptions()
        {
            Should.NotThrow(async() =>
            {
                var counter = 0;
                await Retry.OnAny <ArgumentNullException, NullReferenceException>(async() => {
                    await Task.Yield();
                    counter++;
                });
                counter.ShouldBe(1);
            });

            Should.NotThrow(async() =>
            {
                var counter = 0;
                await Retry.OnAny <ArgumentNullException, NullReferenceException>(async() => {
                    await Task.Yield();
                    counter++;
                },
                                                                                  100.Milliseconds(),
                                                                                  100.Milliseconds(),
                                                                                  100.Milliseconds());
                counter.ShouldBe(1);
            });
        }
        public void When_retrying_a_task_of_result_that_fails_twice_but_succeeds_eventually_on_multiple_exceptions()
        {
            Should.NotThrow(async() =>
            {
                var counter = 0;
                var result  = await Retry.OnAny <ArgumentNullException, NullReferenceException, int>(async() => {
                    await Task.Yield();
                    if (counter++ < 2)
                    {
                        throw new NullReferenceException();
                    }
                    return(42);
                },
                                                                                                     100.Milliseconds(),
                                                                                                     100.Milliseconds(),
                                                                                                     100.Milliseconds());

                counter.ShouldBe(3);
                result.ShouldBe(42);
            });
        }