示例#1
0
        public static void ResearchEditDlg_Handler(ResearchEditDlg dlg)
        {
            GDMResearchRecord resRecord = dlg.Research;

            // tasks
            SelectTab("tabsData", dlg, 0);
            Assert.AreEqual(0, resRecord.Tasks.Count);
            RecordSelectDlgTests.SetCreateItemHandler(fFormTest, TaskEditDlgTests.TaskAdd_Mini_Handler);
            ClickToolStripButton("fTasksList_ToolBar_btnAdd", dlg);
            Assert.AreEqual(1, resRecord.Tasks.Count);

            SelectSheetListItem("fTasksList", dlg, 0);
            SetModalFormHandler(fFormTest, TaskEditDlgTests.TaskAdd_Mini_Handler);
            ClickToolStripButton("fTasksList_ToolBar_btnEdit", dlg);
            Assert.AreEqual(1, resRecord.Tasks.Count);

            SelectSheetListItem("fTasksList", dlg, 0);
            SetModalFormHandler(fFormTest, MessageBox_YesHandler);
            ClickToolStripButton("fTasksList_ToolBar_btnDelete", dlg);
            Assert.AreEqual(0, resRecord.Tasks.Count);

            // communications
            SelectTab("tabsData", dlg, 1);
            Assert.AreEqual(0, resRecord.Communications.Count);
            RecordSelectDlgTests.SetCreateItemHandler(fFormTest, CommunicationEditDlgTests.CommunicationAdd_Mini_Handler);
            ClickToolStripButton("fCommunicationsList_ToolBar_btnAdd", dlg);
            Assert.AreEqual(1, resRecord.Communications.Count);

            SelectSheetListItem("fCommunicationsList", dlg, 0);
            SetModalFormHandler(fFormTest, CommunicationEditDlgTests.CommunicationAdd_Mini_Handler);
            ClickToolStripButton("fCommunicationsList_ToolBar_btnEdit", dlg);
            Assert.AreEqual(1, resRecord.Communications.Count);

            SelectSheetListItem("fCommunicationsList", dlg, 0);
            SetModalFormHandler(fFormTest, MessageBox_YesHandler);
            ClickToolStripButton("fCommunicationsList_ToolBar_btnDelete", dlg);
            Assert.AreEqual(0, resRecord.Communications.Count);

            // groups
            SelectTab("tabsData", dlg, 2);
            Assert.AreEqual(0, resRecord.Groups.Count);
            RecordSelectDlgTests.SetCreateItemHandler(fFormTest, GroupEditDlgTests.GroupAdd_Mini_Handler);
            ClickToolStripButton("fGroupsList_ToolBar_btnAdd", dlg);
            Assert.AreEqual(1, resRecord.Groups.Count);
            Assert.AreEqual("sample group", ((GDMGroupRecord)resRecord.Groups[0].Value).GroupName);

            SelectSheetListItem("fGroupsList", dlg, 0);
            SetModalFormHandler(fFormTest, GroupEditDlgTests.GroupAdd_Mini_Handler);
            ClickToolStripButton("fGroupsList_ToolBar_btnEdit", dlg);
            Assert.AreEqual(1, resRecord.Groups.Count);

            SelectSheetListItem("fGroupsList", dlg, 0);
            SetModalFormHandler(fFormTest, MessageBox_YesHandler);
            ClickToolStripButton("fGroupsList_ToolBar_btnDelete", dlg);
            Assert.AreEqual(0, resRecord.Groups.Count);

            ClickButton("btnAccept", dlg);
        }
示例#2
0
        public override void Setup()
        {
            fBase           = new BaseWindowStub();
            fResearchRecord = new GDMResearchRecord(fBase.Context.Tree);

            fDialog          = new ResearchEditDlg(fBase);
            fDialog.Research = fResearchRecord;
            fDialog.Show();
        }