Esempio n. 1
0
        public async Task HandleError_forwards_to_next_if_retry_count_equal_or_greater_than_maxRetries([Frozen] RetryErrorFilterOptions options, [Frozen] IBusEngine engine, RetryErrorFilter sut, Exception error, NybusEventContext <FirstTestEvent> context, EventErrorDelegate <FirstTestEvent> next)
        {
            context.Message.Headers[Headers.RetryCount] = options.MaxRetries.Stringfy();

            await sut.HandleErrorAsync(context, error, next);

            Mock.Get(engine).VerifyNoOtherCalls();

            Mock.Get(next).Verify(p => p(context, error));
        }
Esempio n. 2
0
        public async Task HandleError_adds_retry_count_if_retry_count_not_present([Frozen] IBusEngine engine, RetryErrorFilter sut, Exception error, NybusCommandContext <FirstTestCommand> context, CommandErrorDelegate <FirstTestCommand> next)
        {
            await sut.HandleErrorAsync(context, error, next);

            Assert.That(context.Message.Headers.ContainsKey(Headers.RetryCount));
        }
Esempio n. 3
0
        public async Task HandleError_retries_if_retry_count_not_present([Frozen] IBusEngine engine, RetryErrorFilter sut, Exception error, NybusCommandContext <FirstTestCommand> context, CommandErrorDelegate <FirstTestCommand> next)
        {
            await sut.HandleErrorAsync(context, error, next);

            Mock.Get(engine).Verify(p => p.SendMessageAsync(context.CommandMessage));
        }
Esempio n. 4
0
        public async Task HandleError_increments_retry_count_if_retry_count_present([Frozen] RetryErrorFilterOptions options, [Frozen] IBusEngine engine, RetryErrorFilter sut, Exception error, NybusCommandContext <FirstTestCommand> context, CommandErrorDelegate <FirstTestCommand> next)
        {
            context.Message.Headers[Headers.RetryCount] = (options.MaxRetries - 2).Stringfy();

            await sut.HandleErrorAsync(context, error, next);

            Assert.That(context.Message.Headers.ContainsKey(Headers.RetryCount));
            Assert.That(context.Message.Headers[Headers.RetryCount], Is.EqualTo((options.MaxRetries - 1).Stringfy()));
        }
Esempio n. 5
0
        public async Task HandleError_retries_if_retry_count_less_than_maxRetries([Frozen] RetryErrorFilterOptions options, [Frozen] IBusEngine engine, RetryErrorFilter sut, Exception error, NybusCommandContext <FirstTestCommand> context, CommandErrorDelegate <FirstTestCommand> next)
        {
            context.Message.Headers[Headers.RetryCount] = (options.MaxRetries - 2).Stringfy();

            await sut.HandleErrorAsync(context, error, next);

            Mock.Get(engine).Verify(p => p.SendMessageAsync(context.CommandMessage));
        }
Esempio n. 6
0
        public async Task HandleError_invokes_next_if_retry_count_equal_or_greater_than_maxRetries([Frozen] RetryErrorFilterOptions options, [Frozen] IBusEngine engine, RetryErrorFilter sut, Exception error, NybusCommandContext <FirstTestCommand> context, CommandErrorDelegate <FirstTestCommand> next)
        {
            context.Message.Headers[Headers.RetryCount] = options.MaxRetries.Stringfy();

            await sut.HandleErrorAsync(context, error, next);

            Mock.Get(next).Verify(p => p(context, error));
        }