Example #1
0
        public void SelectLegTestObj()
        {
            bool success = controller.LoadInitialFile(TestUtil.GetTestFile("selectionmgr\\sampleevent4.coursescribe"), true);

            Assert.IsTrue(success);

            selectionMgr.SelectCourseView(Designator(4));
            CourseLayout course = selectionMgr.CourseLayout;

            foreach (CourseObj courseobj in course)
            {
                if (courseobj is LegCourseObj && courseobj.courseControlId == CourseControlId(13) &&
                    ((LegCourseObj)courseobj).courseControlId2 == CourseControlId(14))
                {
                    selectionMgr.SelectCourseObject(courseobj);
                    break;
                }
            }

            SelectionMgr.SelectionInfo selectionInfo = selectionMgr.Selection;
            Assert.AreEqual(SelectionMgr.SelectionKind.Leg, selectionInfo.SelectionKind);
            Assert.AreEqual(22, selectionInfo.SelectedControl.id);
            Assert.AreEqual(13, selectionInfo.SelectedCourseControl.id);
            Assert.AreEqual(14, selectionInfo.SelectedCourseControl2.id);
            Assert.AreEqual(0, selectionInfo.SelectedSpecial.id);

            CourseObj[] selectedObjects = selectionMgr.SelectedCourseObjects;
            Assert.AreEqual(1, selectedObjects.Length);
            Assert.AreEqual(@"Leg:            control:22  course-control:13  scale:1  course-control2:14  path:N(17.24,5.42)--N(13.76,-5.42)", selectedObjects[0].ToString());
        }