public async Task When_immediate_retries_not_supported_but_policy_demands_it_should_move_to_errors() { var recoverabilityExecutor = CreateExecutor( RetryPolicy.AlwaysRetry(), immediateRetriesSupported: false); var errorContext = CreateErrorContext(messageId: "message-id"); await recoverabilityExecutor.Invoke(errorContext); var failure = messageFaultedNotifications.Single(); Assert.IsEmpty(messageRetriedNotifications); Assert.AreEqual("message-id", failure.Message.MessageId); }
public async Task When_failure_is_handled_with_immediate_retries_notification_should_be_raised() { var recoverabilityExecutor = CreateExecutor(RetryPolicy.AlwaysRetry()); var errorContext = CreateErrorContext(numberOfDeliveryAttempts: 1, exceptionMessage: "test", messageId: "message-id"); await recoverabilityExecutor.Invoke(errorContext); var failure = messageRetriedNotifications.Single(); Assert.AreEqual(0, failure.Attempt); Assert.IsTrue(failure.IsImmediateRetry); Assert.AreEqual("test", failure.Exception.Message); Assert.AreEqual("message-id", failure.Message.MessageId); }
public async Task When_immediate_retries_not_supported_but_policy_demands_it_should_move_to_errors() { var recoverabilityExecutor = CreateExecutor( RetryPolicy.AlwaysRetry(), immediateRetriesSupported: false); var errorContext = CreateErrorContext(messageId: "message-id"); await recoverabilityExecutor.Invoke(errorContext); var failure = eventAggregator.GetNotification <MessageFaulted>(); Assert.AreEqual(1, eventAggregator.NotificationsRaised.Count); Assert.AreEqual("message-id", failure.Message.MessageId); }