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