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)); }
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)); }
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)); }
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())); }
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)); }
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)); }