예제 #1
0
        public static void MessageInspectorCalled()
        {
            var services  = new ServiceCollection();
            var inspector = new TestDispatchMessageInspector();
            var behavior  = new TestServiceBehavior {
                DispatchMessageInspector = inspector
            };

            services.AddSingleton <IServiceBehavior>(behavior);
            ExtensibilityTestHelper.BuildDispatcherAndCallService(services);
            Assert.True(inspector.AfterReceiveCalled);
            Assert.True(inspector.BeforeSendCalled);
            Assert.True(inspector.CorrelationStateMatch);
        }
예제 #2
0
        public static void ReplacementMessageUsed()
        {
            string replacementEchoString = "bbbbb";
            var    services  = new ServiceCollection();
            var    inspector = new MessageReplacingDispatchMessageInspector(replacementEchoString);
            var    behavior  = new TestServiceBehavior {
                DispatchMessageInspector = inspector
            };

            services.AddSingleton <IServiceBehavior>(behavior);
            var service = new DispatcherTestService();

            ExtensibilityTestHelper.BuildDispatcherAndCallService(services, service);
            Assert.Equal(replacementEchoString, service.ReceivedEcho);
        }