Beispiel #1
0
        public void WhenStartingAndEndingSessionAndDisposingPipeline_ThenSessionNotAborted()
        {
            using (var pipeline = PipelineConfig.CreatePipeline())
            {
                pipeline.StartSession();
                Assert.True(pipeline.SessionStarted);
                Assert.False(pipeline.SessionAborted);
                pipeline.EndSession();
                Assert.False(pipeline.SessionStarted);
                Assert.False(pipeline.SessionAborted);
            }

            Assert.Equal(8, HistoryOfVisits.Count);

            Assert.Collection(HistoryOfVisits,
                              x => AssertForVisitor.CalledStartSession(VisitorA, x),
                              x => AssertForVisitor.CalledStartSession(VisitorB, x),
                              x => AssertForVisitor.CalledPostStartSession(VisitorB, x),
                              x => AssertForVisitor.CalledPostStartSession(VisitorA, x),
                              x => AssertForVisitor.CalledEndSession(VisitorA, x),
                              x => AssertForVisitor.CalledEndSession(VisitorB, x),
                              x => AssertForVisitor.CalledPostEndSession(VisitorB, x),
                              x => AssertForVisitor.CalledPostEndSession(VisitorA, x)
                              );
        }
Beispiel #2
0
        private void AssertSessionStartedAndAborted()
        {
            Assert.Equal(8, HistoryOfVisits.Count);

            Assert.Collection(HistoryOfVisits,
                              x => AssertForVisitor.CalledStartSession(VisitorA, x),
                              x => AssertForVisitor.CalledStartSession(VisitorB, x),
                              x => AssertForVisitor.CalledPostStartSession(VisitorB, x),
                              x => AssertForVisitor.CalledPostStartSession(VisitorA, x),
                              x => AssertForVisitor.CalledAbortSession(VisitorA, x),
                              x => AssertForVisitor.CalledAbortSession(VisitorB, x),
                              x => AssertForVisitor.CalledPostAbortSession(VisitorB, x),
                              x => AssertForVisitor.CalledPostAbortSession(VisitorA, x)
                              );
        }
Beispiel #3
0
        public void WhenStartingSession_ThenStartSessionCalledInExpectedStageCommandOrder()
        {
            using (var pipeline = PipelineConfig.CreatePipeline())
            {
                pipeline.StartSession();

                Assert.True(pipeline.SessionStarted);

                Assert.Equal(4, HistoryOfVisits.Count);
                Assert.Collection(HistoryOfVisits,
                                  x => AssertForVisitor.CalledStartSession(VisitorA, x),
                                  x => AssertForVisitor.CalledStartSession(VisitorB, x),
                                  x => AssertForVisitor.CalledPostStartSession(VisitorB, x),
                                  x => AssertForVisitor.CalledPostStartSession(VisitorA, x));
            }
        }
Beispiel #4
0
        public void WhenStartingSessionTwice_ThenSessionOnlyStartedOnce()
        {
            using (var pipeline = PipelineConfig.CreatePipeline())
            {
                pipeline.StartSession();
                pipeline.StartSession();

                Assert.True(pipeline.SessionStarted);

                Assert.Equal(4, HistoryOfVisits.Count);
                Assert.Collection(HistoryOfVisits,
                                  x => AssertForVisitor.CalledStartSession(VisitorA, x),
                                  x => AssertForVisitor.CalledStartSession(VisitorB, x),
                                  x => AssertForVisitor.CalledPostStartSession(VisitorB, x),
                                  x => AssertForVisitor.CalledPostStartSession(VisitorA, x));
            }

            Assert.Equal(8, HistoryOfVisits.Count); // and it has been aborted
        }