public async Task MoveToErrorQueue_should_apply_header_customizations_before_dispatch()
        {
            staticFaultMetadata.Add("staticFaultMetadataKey", "staticFaultMetadataValue");
            var incomingMessage = new IncomingMessage("messageId", new Dictionary <string, string>(), new byte[0]);
            var exception       = new InvalidOperationException("test exception");

            Dictionary <string, string> passedInHeaders = null;

            moveToErrorsExecutor = new MoveToErrorsExecutor(dispatcher, staticFaultMetadata, headers => { passedInHeaders = headers; });

            await moveToErrorsExecutor.MoveToErrorQueue(ErrorQueueAddress, incomingMessage, exception, new TransportTransaction());

            Assert.NotNull(passedInHeaders);
            Assert.That(passedInHeaders, Contains.Key("staticFaultMetadataKey"));
            Assert.That(passedInHeaders, Contains.Key("NServiceBus.ExceptionInfo.Message"));
        }
 public void Setup()
 {
     dispatcher = new FakeDispatcher();
     staticFaultMetadata = new Dictionary<string, string>();
     moveToErrorsExecutor = new MoveToErrorsExecutor(dispatcher, staticFaultMetadata, headers => { });
 }
        public async Task MoveToErrorQueue_should_apply_header_customizations_before_dispatch()
        {
            staticFaultMetadata.Add("staticFaultMetadataKey", "staticFaultMetadataValue");
            var incomingMessage = new IncomingMessage("messageId", new Dictionary<string, string>(), new byte[0]);
            var exception = new InvalidOperationException("test exception");

            Dictionary<string, string> passedInHeaders = null;
            moveToErrorsExecutor = new MoveToErrorsExecutor(dispatcher, staticFaultMetadata, headers => { passedInHeaders = headers; });

            await moveToErrorsExecutor.MoveToErrorQueue(ErrorQueueAddress, incomingMessage, exception, new TransportTransaction());

            Assert.NotNull(passedInHeaders);
            Assert.That(passedInHeaders, Contains.Key("staticFaultMetadataKey"));
            Assert.That(passedInHeaders, Contains.Key("NServiceBus.ExceptionInfo.Message"));
        }
 public void Setup()
 {
     dispatcher           = new FakeDispatcher();
     staticFaultMetadata  = new Dictionary <string, string>();
     moveToErrorsExecutor = new MoveToErrorsExecutor(dispatcher, staticFaultMetadata, headers => { });
 }