public async Task When_SendingWithBombsAndChanged_ItShould_Retry(int numberOfMessages)
        {
            // Arrange
            var numberOfTimebombCalls = (numberOfMessages * SimpleRetryStrategySettings.MaxDeliveryAttempts * 2) / 2;
            var handler  = new TimebombChangedThresholdHandler(numberOfTimebombCalls);
            var services = DefaultServices(handler, 2);
            var provider = services.BuildServiceProvider();
            var bus      = DefaultBus(provider);

            // Act
            var calls = Enumerable
                        .Range(1, numberOfMessages)
                        .Select(x => bus.Advanced.Routing.Send(
                                    DefaultQueue,
                                    x % 2 == 0 ?
                                    new ChangedEvent {
            } :
                                    new TimebombChangedEvent {
                isTimebomb = true
            }
                                    ));
            await Task.WhenAll(calls);

            await handler.WaitThresholdAsync();

            // Assert
            Assert.Equal(numberOfTimebombCalls, handler.HandleCalled);

            var errorTracker = provider.GetService <IErrorTracker>() as FakeErrorTracker;

            Assert.Equal(nameof(TimebombException), errorTracker.ExceptionKinds.Single().Name);
        }
        public async Task When_SendingWithDuds_ItShould_Complete(int numberOfMessages)
        {
            // Arrange
            var handler  = new TimebombChangedThresholdHandler(numberOfMessages);
            var services = DefaultServices(handler);
            var provider = services.BuildServiceProvider();
            var bus      = DefaultBus(provider);

            // Act
            var calls = Enumerable
                        .Range(1, numberOfMessages)
                        .Select(x => bus.Advanced.Routing.Send(DefaultQueue, new TimebombChangedEvent()));
            await Task.WhenAll(calls);

            await handler.WaitThresholdAsync();

            // Assert
            Assert.Equal(numberOfMessages, handler.HandleCalled);
        }