Beispiel #1
0
        /// <inheritdoc />
        protected override void Then(CourseWindow window)
        {
            ICourse result = ExtractTraining(window);

            IChapter firstChapter = result.Data.Chapters.First();

            Assert.NotNull(firstChapter);

            IStep firstStep = firstChapter.Data.FirstStep;

            Assert.NotNull(firstStep);

            IList <ITransition> transitions = GetTransitionsFromStep(firstStep);

            Assert.That(transitions.Count == 1);

            IStep nextStep;

            if (TryToGetStepFromTransition(transitions.First(), out nextStep))
            {
                Assert.Fail("First step is not the end of the chapter.");
            }

            Assert.Null(nextStep);
        }
Beispiel #2
0
        /// <inheritdoc />
        protected override void Then(CourseWindow window)
        {
            ICourse  result       = ExtractTraining(window);
            IChapter firstChapter = result.Data.Chapters.First();

            // The chapter exits
            Assert.NotNull(firstChapter);

            // The step exits
            IStep firstStep = firstChapter.Data.FirstStep;

            Assert.NotNull(firstChapter);

            IList <ITransition> transitions = GetTransitionsFromStep(firstStep);

            // It has two transition.
            Assert.That(transitions.Count == 2);

            ITransition firstTransition  = transitions[0];
            ITransition secondTransition = transitions[1];
            IStep       nextStep;

            // The first step's transition points to itself.
            if (TryToGetStepFromTransition(firstTransition, out nextStep))
            {
                Assert.That(firstStep == nextStep);
            }

            // The second step's transition is the end of the course.
            Assert.False(TryToGetStepFromTransition(secondTransition, out nextStep));
        }
Beispiel #3
0
        /// <inheritdoc />
        protected override CourseWindow Given()
        {
            CourseWindow window = base.Given();

            iteratedSteps = 0;

            return(window);
        }
 /// <inheritdoc/>
 public void HandleStartEditingCourse()
 {
     if (courseWindow == null)
     {
         courseWindow         = EditorWindow.GetWindow <CourseWindow>();
         courseWindow.minSize = new Vector2(400f, 100f);
     }
     else
     {
         courseWindow.Focus();
     }
 }
        /// <inheritdoc/>
        public void HandleCourseWindowClosed(CourseWindow window)
        {
            if (courseWindow != window)
            {
                return;
            }

            if (CurrentCourse != null)
            {
                CourseAssetManager.Save(CurrentCourse);
            }
        }
        protected override void Then(CourseWindow window)
        {
            IList <IStep> steps = window.GetCourse().Data.FirstChapter.Data.Steps;

            Assert.AreEqual(2, steps.Count);
            Assert.AreEqual("Copy of " + steps[0].Data.Name, steps[1].Data.Name);
            Assert.True(steps[0].Data.Behaviors.Data.Behaviors.Count == 0);
            Assert.True(steps[1].Data.Behaviors.Data.Behaviors.Count == 0);
            Assert.True(steps[0].Data.Transitions.Data.Transitions.Count == 1);
            Assert.True(steps[1].Data.Transitions.Data.Transitions.Count == 1);
            Assert.Null(steps[0].Data.Transitions.Data.Transitions[0].Data.TargetStep);
            Assert.Null(steps[1].Data.Transitions.Data.Transitions[0].Data.TargetStep);
        }
Beispiel #7
0
        /// <inheritdoc />
        protected override void Then(CourseWindow window)
        {
            ICourse  result       = ExtractTraining(window);
            IChapter firstChapter = result.Data.Chapters.First();

            Assert.NotNull(firstChapter);

            IStep         firstStep = firstChapter.Data.FirstStep;
            IList <IStep> steps     = firstChapter.Data.Steps;

            validatedSteps.Clear();
            ValidateLinearCourse(firstStep);

            Assert.That(iteratedSteps == steps.Count);
        }
Beispiel #8
0
        /// <inheritdoc />
        protected override void Then(CourseWindow window)
        {
            ICourse result = ExtractTraining(window);

            IChapter firstChapter = result.Data.Chapters.First();

            Assert.NotNull(firstChapter);

            IStep firstStep = firstChapter.Data.FirstStep;

            Assert.NotNull(firstStep);

            IList <ITransition> transitions = GetTransitionsFromStep(firstStep);

            Assert.That(transitions.Count == 2);

            foreach (ITransition transition in transitions)
            {
                IStep nextStep;

                if (TryToGetStepFromTransition(transition, out nextStep) == false)
                {
                    Assert.Fail("First step does not always go to another step.");
                }

                IList <ITransition> transitionsFromNextStep = GetTransitionsFromStep(nextStep);
                Assert.That(transitionsFromNextStep.Count == 1);

                IStep endOfChapter;

                if (TryToGetStepFromTransition(transitionsFromNextStep.First(), out endOfChapter))
                {
                    Assert.Fail("Branched step is not the end of the chapter.");
                }
            }
        }
Beispiel #9
0
 /// <summary>
 /// Notifies selected <see cref="IEditingStrategy"/> when a <see cref="CourseWindow"/> was closed.
 /// </summary>
 internal static void CourseWindowClosed(CourseWindow window)
 {
     strategy.HandleCourseWindowClosed(window);
 }
Beispiel #10
0
 /// <summary>
 /// Notifies selected <see cref="IEditingStrategy"/> when a new <see cref="CourseWindow"/> was just opened.
 /// </summary>
 internal static void CourseWindowOpened(CourseWindow window)
 {
     strategy.HandleNewCourseWindow(window);
 }
Beispiel #11
0
        private void OpenCourseWindowButton_Click(object sender, RoutedEventArgs e)
        {
            CourseWindow cw = new CourseWindow();

            cw.Show();
        }
Beispiel #12
0
        /// <inheritdoc />
        protected override CourseWindow Given()
        {
            CourseWindow window = base.Given();

            return(window);
        }
 /// <inheritdoc/>
 public void HandleNewCourseWindow(CourseWindow window)
 {
     courseWindow = window;
     courseWindow.SetCourse(CurrentCourse);
 }
Beispiel #14
0
 /// <inheritdoc/>
 public void HandleCourseWindowClosed(CourseWindow window)
 {
 }
Beispiel #15
0
 /// <inheritdoc/>
 public void HandleNewCourseWindow(CourseWindow window)
 {
 }