public async Task Invoke_when_dispatching_message_fails_should_keep_timeout_in_storage()
        {
            var messageDispatcher = new FailingMessageDispatcher();
            var timeoutPersister = new InMemoryTimeoutPersister(() => DateTime.UtcNow);
            var behavior = new DispatchTimeoutBehavior(messageDispatcher, timeoutPersister, TransportTransactionMode.TransactionScope);
            var timeoutData = CreateTimeout();
            await timeoutPersister.Add(timeoutData, null);

            Assert.That(async () => await behavior.Invoke(CreateContext(timeoutData.Id)), Throws.InstanceOf<Exception>());

            var result = await timeoutPersister.Peek(timeoutData.Id, null);
            Assert.NotNull(result);
        }
Beispiel #2
0
        public async Task Invoke_when_dispatching_message_fails_should_keep_timeout_in_storage()
        {
            var messageDispatcher = new FailingMessageDispatcher();
            var timeoutPersister  = new InMemoryTimeoutPersister(() => DateTime.UtcNow);
            var behavior          = new DispatchTimeoutBehavior(messageDispatcher, timeoutPersister, TransportTransactionMode.TransactionScope);
            var timeoutData       = CreateTimeout();
            await timeoutPersister.Add(timeoutData, null);

            Assert.That(async() => await behavior.Invoke(CreateContext(timeoutData.Id)), Throws.InstanceOf <Exception>());

            var result = await timeoutPersister.Peek(timeoutData.Id, null);

            Assert.NotNull(result);
        }