Exemple #1
0
        public void TestCompleteRun_2Steps()
        {
            var tour = new Tour();

            tour.Steps = new[]
            {
                new Step("1", "Header1", "Content1"),
                new Step("2", "Header2", "Content2"),
            };

            var manager        = new VisualElementManagerMock(tour.Steps);
            var windowManager  = new WindowManagerMock();
            var popupNavigator = new PopupNavigatorMock();
            var tourRun        = new TourRun(tour, manager, windowManager, popupNavigator);

            tourRun.Start();

            Assert.AreEqual(tour.Steps[0], tourRun.CurrentStep);
            Assert.AreEqual(1, tourRun.CurrentStepNo);

            Assert.IsTrue(tourRun.CanNextStep());
            Assert.IsTrue(tourRun.NextStep());
            Assert.AreEqual(tour.Steps[1], tourRun.CurrentStep);
            Assert.AreEqual(2, tourRun.CurrentStepNo);

            Assert.IsFalse(tourRun.CanNextStep());
            Assert.IsFalse(tourRun.NextStep());
            tourRun.Close();

            AssertManagerIsClean(popupNavigator, windowManager);
        }
Exemple #2
0
        public void TestCompleteRun_2Steps_UsingNavigator()
        {
            var navigator = FeatureTour.GetNavigator();
            var tour      = new Tour();

            tour.Steps = new[]
            {
                new Step("1", "Header1", "Content1"),
                new Step("2", "Header2", "Content2"),
            };

            var manager        = new VisualElementManagerMock(tour.Steps);
            var windowManager  = new WindowManagerMock();
            var popupNavigator = new PopupNavigatorMock();
            var tourRun        = new TourRun(tour, manager, windowManager, popupNavigator);

            FeatureTour.SetTourRun(tourRun);
            tourRun.Start();

            Assert.AreEqual(tour.Steps[0], FeatureTour.CurrentStep);

            Assert.IsTrue(navigator.IfCurrentStepEquals(FeatureTour.CurrentStep.ID).GoNext());
            Assert.AreEqual(tour.Steps[1], FeatureTour.CurrentStep);

            Assert.IsFalse(navigator.IfCurrentStepEquals(FeatureTour.CurrentStep.ID).GoNext());
            Assert.AreEqual(tour.Steps[1], FeatureTour.CurrentStep);

            Assert.IsTrue(navigator.IfCurrentStepEquals(FeatureTour.CurrentStep.ID).GoPrevious());
            Assert.AreEqual(tour.Steps[0], FeatureTour.CurrentStep);

            Assert.IsFalse(navigator.IfCurrentStepEquals(FeatureTour.CurrentStep.ID).GoPrevious());
            Assert.AreEqual(tour.Steps[0], FeatureTour.CurrentStep);

            Assert.IsTrue(navigator.Close());
            Assert.AreEqual(null, FeatureTour.CurrentStep);

            AssertManagerIsClean(popupNavigator, windowManager);

            FeatureTour.SetCurrentRunNull();
        }
Exemple #3
0
        public void TestCompleteRun_2Steps_WithPreviouse()
        {
            var tour = new Tour();

            tour.Steps = new[]
            {
                new Step("1", "Header1", "Content1"),
                new Step("2", "Header2", "Content2"),
            };

            var manager        = new VisualElementManagerMock(tour.Steps);
            var windowManager  = new WindowManagerMock();
            var popupNavigator = new PopupNavigatorMock();
            var tourRun        = new TourRun(tour, manager, windowManager, popupNavigator);

            Assert.IsNull(popupNavigator.ViewModel);

            tourRun.Start();
            Assert.IsNotNull(popupNavigator.ViewModel);

            AssertStep(tour, 0, tourRun, popupNavigator);

            Assert.IsTrue(tourRun.CanNextStep());
            Assert.IsTrue(tourRun.NextStep());
            AssertStep(tour, 1, tourRun, popupNavigator);

            Assert.IsTrue(tourRun.CanPreviousStep());
            Assert.IsTrue(tourRun.PreviousStep());
            AssertStep(tour, 0, tourRun, popupNavigator);

            Assert.IsFalse(tourRun.PreviousStep());
            Assert.IsFalse(tourRun.PreviousStep());
            tourRun.Close();

            AssertManagerIsClean(popupNavigator, windowManager);
        }