Пример #1
0
        private ICourse CreateTrainingCourse(int length)
        {
            LinearChapterBuilder chapterBuilder = new LinearChapterBuilder("chapter");

            for (int i = 0; i < length; i++)
            {
                chapterBuilder.AddStep(new BasicStepBuilder("Step#" + i));
            }

            return(new LinearTrainingBuilder("Training")
                   .AddChapter(chapterBuilder)
                   .Build());
        }
Пример #2
0
        public IEnumerator FastForwardInactiveChapter()
        {
            // Given a chapter,
            Chapter chapter = new LinearChapterBuilder("Chapter")
                              .AddStep(new BasicStepBuilder("Step")
                                       .AddCondition(new EndlessConditionMock()))
                              .Build();

            // When it's marked to be fast-forwarded,
            chapter.LifeCycle.MarkToFastForward();

            yield return(null);

            chapter.Update();

            // Then it doesn't start its activation on its own.
            Assert.AreEqual(Stage.Inactive, chapter.LifeCycle.Stage);
        }
Пример #3
0
        public IEnumerator FastForwardInactiveChapterAndThenActivate()
        {
            // Given a chapter,
            Chapter chapter = new LinearChapterBuilder("Chapter")
                              .AddStep(new BasicStepBuilder("Step")
                                       .AddCondition(new EndlessConditionMock()))
                              .Build();

            chapter.Configure(RuntimeConfigurator.Configuration.Modes.CurrentMode);

            // When it's marked to be fast-forwarded,
            chapter.LifeCycle.MarkToFastForward();
            chapter.LifeCycle.Activate();

            // Then it's activated.
            Assert.AreEqual(Stage.Active, chapter.LifeCycle.Stage);

            yield break;
        }
Пример #4
0
        public IEnumerator FastForwardActiveChapter()
        {
            // Given an activated chapter,
            Chapter chapter = new LinearChapterBuilder("Chapter")
                              .AddStep(new BasicStepBuilder("Step")
                                       .DisableAutomaticAudioHandling()
                                       .AddCondition(new EndlessCondition()))
                              .Build();

            chapter.Configure(RuntimeConfigurator.Configuration.GetCurrentMode());

            chapter.LifeCycle.Activate();

            // When it's marked to be fast-forwarded,
            chapter.LifeCycle.MarkToFastForward();

            yield return(null);

            chapter.Update();

            // Then it's activated.
            Assert.AreEqual(Stage.Active, chapter.LifeCycle.Stage);
        }