Esempio n. 1
0
        public void AfterCompletionWithSendException()
        {
            AbstractMessageChannel testChannel = new AfterCompletionWithSendExceptionChannel();

            var interceptor1 = new PreSendInterceptor();
            var interceptor2 = new PreSendInterceptor();

            testChannel.AddInterceptor(interceptor1);
            testChannel.AddInterceptor(interceptor2);
            try
            {
                testChannel.Send(MessageBuilder.WithPayload("test").Build());
            }
            catch (Exception ex)
            {
                Assert.Equal("Simulated exception", ex.InnerException.Message);
            }

            Assert.True(interceptor1.WasAfterCompletionInvoked);
            Assert.True(interceptor2.WasAfterCompletionInvoked);
        }
        public void AfterCompletionWithSendException()
        {
            AbstractMessageChannel testChannel = new AfterCompletionWithSendExceptionChannel(provider.GetService <IApplicationContext>());

            var interceptor1 = new AfterCompletionTestInterceptor();
            var interceptor2 = new AfterCompletionTestInterceptor();

            testChannel.AddInterceptor(interceptor1);
            testChannel.AddInterceptor(interceptor2);
            try
            {
                testChannel.Send(Support.IntegrationMessageBuilder.WithPayload("test").Build());
            }
            catch (Exception ex)
            {
                Assert.Equal("Simulated exception", ex.InnerException.Message);
            }

            Assert.True(interceptor1.AfterCompletionInvoked);
            Assert.True(interceptor2.AfterCompletionInvoked);
        }