Пример #1
0
 public void Execution_of_pipeline_is_cancellable_by_member()
 {
     var t = new PublishPipelineTester<MessageA>();
     t.Mock1.Setup(pm => pm.LookAt(It.IsAny<PublishToken>())).Callback((PublishToken token) => token.Cancel = true);
     t.TestWith(pp => pp.DefaultPublishPipeline(t.Mock1Object, t.Mock2Object));
     t.VerifyCalled(t.Mock1);
     t.VerifyNotCalled(t.Mock2);
 }
Пример #2
0
        public void publish_pipeline_is_extensible()
        {
            var t = new PublishPipelineTester<MessageB>();
            t.TestWith(pp => pp.DefaultPublishPipeline(t.Mock1Object, t.Mock2Object));

            t.Mock1.VerifyCalled();
            t.Mock2.VerifyCalled();
        }
Пример #3
0
 public void Execution_of_pipeline_is_cancellable_by_member()
 {
     var t = new PublishPipelineTester<MessageA>();
     t.Mock1.CancelTokenWhenSeen();
     t.TestWith(pp => pp.DefaultPublishPipeline(t.Mock1Object, t.Mock2Object));
     t.Mock1.VerifyCalled();
     t.Mock2.VerifyNotCalled();
 }
Пример #4
0
        public void publish_pipeline_is_extensible()
        {
            var t = new PublishPipelineTester <MessageB>();

            t.TestWith(pp => pp.DefaultPublishPipeline(t.Mock1Object, t.Mock2Object));

            t.Mock1.VerifyCalled();
            t.Mock2.VerifyCalled();
        }
Пример #5
0
        public void Execution_of_pipeline_is_cancellable_by_member()
        {
            var t = new PublishPipelineTester <MessageA>();

            t.Mock1.CancelTokenWhenSeen();
            t.TestWith(pp => pp.DefaultPublishPipeline(t.Mock1Object, t.Mock2Object));
            t.Mock1.VerifyCalled();
            t.Mock2.VerifyNotCalled();
        }
Пример #6
0
        public void default_pubish_pipeline_is_replaceable()
        {
            var t = new PublishPipelineTester <MessageB>();
            var b = BusSetup.StartWith <Conservative>()
                    .Apply(cb => cb.ConfigurePublishing(cp => cp.DefaultPublishPipeline(t.Mock1Object)))
                    .Construct();

            b.Publish(new MessageB());

            t.Mock1.VerifyCalled();
        }
Пример #7
0
        public void default_pubish_pipeline_is_replaceable()
        {
            var t = new PublishPipelineTester<MessageB>();
            var b = BusSetup.StartWith<Conservative>()
                .Apply(cb => cb.ConfigurePublishing(cp => cp.DefaultPublishPipeline(t.Mock1Object)))
                .Construct();

            b.Publish(new MessageB());

            t.Mock1.VerifyCalled();
        }
Пример #8
0
        public void non_default_publish_pipeline_takes_precedence()
        {
            var t = new PublishPipelineTester<MessageA>();
            t.TestWith(
                pp =>
                    {
                        pp.DefaultPublishPipeline(t.Mock1Object, t.Mock2Object);
                        pp.MessageMatch(mi => mi.IsType<MessageA>()).PublishPipeline(t.Mock2Object);
                    });

            t.VerifyNotCalled(t.Mock1);
            t.VerifyCalled(t.Mock2);
        }
Пример #9
0
        public void default_publish_pipeline_is_fallback()
        {
            var t = new PublishPipelineTester<MessageA>();
            t.TestWith(pp =>
                           {
                               pp.DefaultPublishPipeline(t.Mock1Object, t.Mock3Object);
                               pp.MessageMatch(mi => mi.IsType<MessageB>()).PublishPipeline(t.Mock2Object);
                           });

            t.VerifyCalled(t.Mock1);
            t.VerifyNotCalled(t.Mock2);
            t.VerifyCalled(t.Mock3);
        }
Пример #10
0
        public void non_default_publish_pipeline_takes_precedence()
        {
            var t = new PublishPipelineTester <MessageA>();

            t.TestWith(
                pp =>
            {
                pp.DefaultPublishPipeline(t.Mock1Object, t.Mock2Object);
                pp.MessageMatch(mi => mi.IsType <MessageA>()).PublishPipeline(t.Mock2Object);
            });


            t.Mock1.VerifyNotCalled();
            t.Mock2.VerifyCalled();
        }
Пример #11
0
        public void default_publish_pipeline_is_fallback()
        {
            var t = new PublishPipelineTester <MessageA>();

            t.TestWith(pp =>
            {
                pp.DefaultPublishPipeline(t.Mock1Object, t.Mock3Object);
                pp.MessageMatch(mi => mi.IsType <MessageB>()).PublishPipeline(t.Mock2Object);
            });


            t.Mock1.VerifyCalled();
            t.Mock2.VerifyNotCalled();
            t.Mock3.VerifyCalled();
        }