Ejemplo n.º 1
0
        public void Should_be_able_to_register_events_after_existing_event()
        {
            var pipeline = new Pipeline();

            pipeline.RegisterStage("Stage")
                    .WithEvent<MockPipelineEvent3>()
                    .AfterEvent<MockPipelineEvent3>().Register<MockPipelineEvent2>()
                    .AfterEvent<MockPipelineEvent2>().Register(new MockPipelineEvent1());

            var observer = new MockAuthenticateObserver();

            pipeline.RegisterObserver(observer);

            pipeline.Execute();

            Assert.AreEqual("321", observer.CallSequence);
        }
Ejemplo n.º 2
0
        public void Should_be_able_to_execute_a_valid_pipeline()
        {
            var pipeline = new Pipeline();

            pipeline
                .RegisterStage("Stage")
                .WithEvent<MockPipelineEvent1>()
                .WithEvent<MockPipelineEvent2>()
                .WithEvent<MockPipelineEvent3>();

            var observer = new MockAuthenticateObserver();

            pipeline.RegisterObserver(observer);

            pipeline.Execute();

            Assert.AreEqual("123", observer.CallSequence);
        }