public async Task Should_Reschedule_Timeouts()
        {
            var expectedDeliveryAt = new DateTimeOffset(new DateTime(2020, 1, 1));

            var scenarioContext = new IntegrationScenarioContext();

            scenarioContext.RegisterTimeoutRescheduleRule <AMessage>((msg, currentDelay) =>
            {
                return(new DoNotDeliverBefore(expectedDeliveryAt));
            });

            var context = new TestableOutgoingSendContext
            {
                Message = new OutgoingLogicalMessage(typeof(AMessage), new AMessage())
            };

            context.Headers.Add(Headers.SagaId, "a-saga-id");
            context.Headers.Add(Headers.SagaType, "a-saga-type");
            context.Headers.Add(Headers.IsSagaTimeoutMessage, bool.TrueString);

            var properties = new DispatchProperties {
                DoNotDeliverBefore = new DoNotDeliverBefore(new DateTime(2030, 1, 1))
            };

            context.Extensions.Set(properties);

            var sut = new RescheduleTimeoutsBehavior(scenarioContext);;
            await sut.Invoke(context, () => Task.CompletedTask).ConfigureAwait(false);

            var rescheduledDoNotDeliverBefore = properties.DoNotDeliverBefore;

            Assert.AreEqual(expectedDeliveryAt, rescheduledDoNotDeliverBefore.At);
        }