public async Task Prepare_should_set_prepare_state() { var summary = new InMemoryRetry("abc123", RetryType.FailureGroup, new FakeDomainEvents()); await summary.Prepare(1000); Assert.AreEqual(RetryState.Preparing, summary.RetryState); Assert.AreEqual(0, summary.NumberOfMessagesPrepared); Assert.AreEqual(1000, summary.TotalNumberOfMessages); }
public void Prepare_should_set_prepare_state() { var summary = new InMemoryRetry("abc123", RetryType.FailureGroup); summary.Prepare(1000); Assert.AreEqual(RetryState.Preparing, summary.RetryState); Assert.AreEqual(0, summary.NumberOfMessagesPrepared); Assert.AreEqual(1000, summary.TotalNumberOfMessages); }
public void Forwarding_should_set_forwarding_state() { var summary = new InMemoryRetry("abc123", RetryType.FailureGroup); summary.Prepare(1000); summary.PrepareBatch(1000); summary.Forwarding(); Assert.AreEqual(RetryState.Forwarding, summary.RetryState); Assert.AreEqual(0, summary.NumberOfMessagesForwarded); Assert.AreEqual(1000, summary.TotalNumberOfMessages); }
public void Skip_should_complete_when_all_skipped() { var summary = new InMemoryRetry("abc123", RetryType.FailureGroup); summary.Wait(DateTime.UtcNow); summary.Prepare(1000); summary.PrepareBatch(1000); summary.Skip(1000); Assert.AreEqual(RetryState.Completed, summary.RetryState); Assert.AreEqual(1000, summary.NumberOfMessagesSkipped); }
public void Skip_should_set_update_skipped_messages() { var summary = new InMemoryRetry("abc123", RetryType.FailureGroup); summary.Wait(DateTime.UtcNow); summary.Prepare(2000); summary.PrepareBatch(1000); summary.Skip(1000); Assert.AreEqual(RetryState.Preparing, summary.RetryState); Assert.AreEqual(1000, summary.NumberOfMessagesSkipped); }
public void Batch_forwarded_all_forwarded_should_set_completed_state() { var summary = new InMemoryRetry("abc123", RetryType.FailureGroup, new FakeDomainEvents()); summary.Prepare(1000); summary.PrepareBatch(1000); summary.Forwarding(); summary.BatchForwarded(1000); Assert.AreEqual(RetryState.Completed, summary.RetryState); Assert.AreEqual(1000, summary.NumberOfMessagesForwarded); Assert.AreEqual(1000, summary.TotalNumberOfMessages); }
public async Task Batch_forwarded_should_set_forwarding_state() { var summary = new InMemoryRetry("abc123", RetryType.FailureGroup, new FakeDomainEvents()); await summary.Prepare(1000); await summary.PrepareBatch(1000); await summary.Forwarding(); await summary.BatchForwarded(500); Assert.AreEqual(RetryState.Forwarding, summary.RetryState); Assert.AreEqual(500, summary.NumberOfMessagesForwarded); Assert.AreEqual(1000, summary.TotalNumberOfMessages); }
public void Skip_and_forward_combination_should_complete_when_done() { var summary = new InMemoryRetry("abc123", RetryType.FailureGroup); summary.Wait(DateTime.UtcNow); summary.Prepare(2000); summary.PrepareBatch(1000); summary.Skip(1000); summary.Forwarding(); summary.BatchForwarded(1000); Assert.AreEqual(RetryState.Completed, summary.RetryState); Assert.AreEqual(1000, summary.NumberOfMessagesForwarded); Assert.AreEqual(1000, summary.NumberOfMessagesSkipped); }
public void Should_raise_domain_events() { var domainEvents = new FakeDomainEvents(); var summary = new InMemoryRetry("abc123", RetryType.FailureGroup, domainEvents); summary.Prepare(1000); summary.PrepareBatch(1000); summary.Forwarding(); summary.BatchForwarded(1000); Assert.IsTrue(domainEvents.RaisedEvents[0] is RetryOperationPreparing); Assert.IsTrue(domainEvents.RaisedEvents[1] is RetryOperationPreparing); Assert.IsTrue(domainEvents.RaisedEvents[2] is RetryOperationForwarding); Assert.IsTrue(domainEvents.RaisedEvents[3] is RetryMessagesForwarded); Assert.IsTrue(domainEvents.RaisedEvents[4] is RetryOperationCompleted); }