Ejemplo n.º 1
0
        public void MapExchangeSelectionChanges()
        {
            bool success = controller.LoadInitialFile(TestUtil.GetTestFile("selectionmgr\\mapexchange2.ppen"), true);

            Assert.IsTrue(success);

            UndoMgr undoMgr = controller.GetUndoMgr();
            EventDB eventDB = controller.GetEventDB();

            selectionMgr.ActiveTab = selectionMgr.TabCount - 1;  // last tab
            selectionMgr.SelectCourseControl(CourseControlId(602));
            Assert.IsTrue(selectionMgr.Selection.SelectedCourseControl.id == 602);
            selectionMgr.SelectCourseView(new CourseDesignator(selectionMgr.Selection.ActiveCourseDesignator.CourseId, 0));
            Assert.IsTrue(selectionMgr.Selection.SelectedCourseControl.id == 602);
            selectionMgr.SelectCourseView(new CourseDesignator(selectionMgr.Selection.ActiveCourseDesignator.CourseId, 1));
            Assert.IsTrue(selectionMgr.Selection.SelectedCourseControl.IsNone);

            selectionMgr.SelectLeg(CourseControlId(611), CourseControlId(612), LegInsertionLoc.Normal);
            Assert.IsTrue(selectionMgr.Selection.SelectedCourseControl.id == 611);
            Assert.IsTrue(selectionMgr.Selection.SelectedCourseControl2.id == 612);
            selectionMgr.SelectCourseView(new CourseDesignator(selectionMgr.Selection.ActiveCourseDesignator.CourseId, 0));
            Assert.IsTrue(selectionMgr.Selection.SelectedCourseControl.IsNone);
            Assert.IsTrue(selectionMgr.Selection.SelectedCourseControl2.IsNone);

            selectionMgr.SelectCourseView(new CourseDesignator(selectionMgr.Selection.ActiveCourseDesignator.CourseId, 3));
            Assert.IsTrue(selectionMgr.Selection.ActiveCourseDesignator.Part == 3);
            undoMgr.BeginCommand(912, "Remove Course Control");
            ChangeEvent.RemoveCourseControl(eventDB, selectionMgr.Selection.ActiveCourseDesignator.CourseId, CourseControlId(615));
            undoMgr.EndCommand(912);
            Assert.AreEqual(2, selectionMgr.Selection.ActiveCourseDesignator.Part);

            undoMgr.BeginCommand(915, "Remove Course Controls");
            ChangeEvent.RemoveCourseControl(eventDB, selectionMgr.Selection.ActiveCourseDesignator.CourseId, CourseControlId(611));
            ChangeEvent.RemoveCourseControl(eventDB, selectionMgr.Selection.ActiveCourseDesignator.CourseId, CourseControlId(616));
            undoMgr.EndCommand(915);
            Assert.IsTrue(selectionMgr.Selection.ActiveCourseDesignator.AllParts);
        }