public static void MessageInspectorCalled()
        {
            var services  = new ServiceCollection();
            var inspector = new TestDispatchMessageInspector();
            var behavior  = new TestServiceBehavior {
                DispatchMessageInspector = inspector
            };

            services.AddSingleton <IServiceBehavior>(behavior);
            TestHelper.BuildDispatcherAndCallDefaultService(services);
            Assert.True(inspector.AfterReceiveCalled);
            Assert.True(inspector.BeforeSendCalled);
            Assert.True(inspector.CorrelationStateMatch);
        }
Exemple #2
0
        public static void MessageInspectorCalled()
        {
            var inspector = new TestDispatchMessageInspector();
            var behavior  = new TestServiceBehavior {
                DispatchMessageInspector = inspector
            };
            var factory = ExtensibilityHelper.CreateChannelFactory <SimpleService, ISimpleService>(behavior);

            factory.Open();
            var channel = factory.CreateChannel();
            var echo    = channel.Echo("hello");

            Assert.Equal("hello", echo);
            Assert.True(inspector.AfterReceiveCalled);
            Assert.True(inspector.BeforeSendCalled);
            Assert.True(inspector.CorrelationStateMatch);
            ((System.ServiceModel.Channels.IChannel)channel).Close();
            factory.Close();
            TestHelper.CloseServiceModelObjects((System.ServiceModel.Channels.IChannel)channel, factory);
        }