public void Setup() { this.pipelineStepRaisingException = async() => { await Task.Run(() => { throw new InvalidOperationException(); }); }; this.testTransportMessage = new TestTransportMessage(typeof(Message).AssemblyQualifiedName); var readOnlyConfiguration = new EndpointConfiguration.ReadOnly(new EndpointConfiguration().MaximumImmediateRetryCount(MaxImmediateRetryCount).MaximumDelayedRetryCount(MaxDelayedRetryCount)); var logicalMessage = new LogicalMessage(typeof(Message), new Message(), null); this.incomingLogicalContext = new IncomingLogicalContext(logicalMessage, this.testTransportMessage, readOnlyConfiguration); this.busMock = new Mock <IBusForHandler>(); this.testee = new DelayMessagesWhenImmediateRetryCountIsReachedStep(); }
public void WhenMessageReachesMaximumNumberOfDelayedRetries_MessageIsDeadlettered() { var stream = new MemoryStream(); var writer = new StreamWriter(stream); writer.Write("{ Bar: 1 }"); writer.Flush(); stream.Position = 0; actualDelayedRetryCount = MaxDelayedRetryCount; var tm = new TestTransportMessage(typeof(Message).AssemblyQualifiedName); tm.SetBody(stream); Func <Task> action = () => this.receiver.HandOver(tm); action.ShouldThrow <InvalidOperationException>(); tm.DeadLetterHeaders.Should().NotBeEmpty(); tm.DelayedDeliveryCount.Should().Be(MaxDelayedRetryCount); }
public void Setup() { try { throw new InvalidOperationException("Internal test exception"); } catch (Exception exc) { this.internalException = exc; } this.pipelineStepRaisingException = async() => { await Task.Run(() => { throw new InvalidOperationException(); }); }; this.pipelineStepRaisingDeadletterMessageImmediatelyException = async() => { await Task.Run(() => { throw new DeadletterMessageImmediatelyException(this.internalException); }); }; this.testTransportMessage = new TestTransportMessage(typeof(Message).AssemblyQualifiedName); var readOnlyConfiguration = new EndpointConfiguration.ReadOnly(new EndpointConfiguration().MaximumImmediateRetryCount(10).MaximumDelayedRetryCount(10)); var logicalMessage = new LogicalMessage(typeof(Message), new Message(), null); this.incomingLogicalContext = new IncomingLogicalContext(logicalMessage, this.testTransportMessage, readOnlyConfiguration); this.busMock = new Mock <IBusForHandler>(); this.testee = new DeadletterMessageImmediatelyExceptionStep(); }