コード例 #1
0
ファイル: TreeToolsTests.cs プロジェクト: chipsi/gedkeeper
        public void Test_CheckBaseAndRepairProblem()
        {
            List <TreeTools.CheckObj> checksList = new List <TreeTools.CheckObj>();

            Assert.Throws(typeof(ArgumentNullException), () => { TreeTools.CheckBase(null, checksList); });
            Assert.Throws(typeof(ArgumentNullException), () => { TreeTools.CheckBase(fBaseWin, null); });

            TreeTools.CheckBase(fBaseWin, checksList);
            Assert.AreEqual(3, checksList.Count);

            Assert.AreEqual(TreeTools.CheckDiag.cdStrangeSpouse, checksList[0].Diag);
            Assert.AreEqual(TreeTools.CheckDiag.cdPersonLonglived, checksList[2].Diag);

            Assert.Throws(typeof(ArgumentNullException), () => { TreeTools.RepairProblem(null, null); });
            Assert.Throws(typeof(ArgumentNullException), () => { TreeTools.RepairProblem(fBaseWin, null); });

            TreeTools.RepairProblem(fBaseWin, checksList[2]);
        }
コード例 #2
0
 public void Repair()
 {
     try {
         int num = fView.ChecksList.Items.Count;
         for (int i = 0; i < num; i++)
         {
             IListItem item = fView.ChecksList.Items[i];
             if (item.Checked)
             {
                 var checkObj = item.Data as TreeTools.CheckObj;
                 TreeTools.RepairProblem(fBase, checkObj);
             }
         }
     } finally {
         fBase.RefreshLists(false);
         CheckBase();
     }
 }
コード例 #3
0
        public void Test_CheckBaseAndRepairProblem()
        {
            List <TreeTools.CheckObj> checksList = new List <TreeTools.CheckObj>();

            Assert.Throws(typeof(ArgumentNullException), () => { TreeTools.CheckBase(null, checksList); });
            Assert.Throws(typeof(ArgumentNullException), () => { TreeTools.CheckBase(fBaseWin, null); });

            // three records with errors + multimedia with a nonexistent file
            TreeTools.CheckBase(fBaseWin, checksList);
            Assert.AreEqual(3 + 1, checksList.Count);

            Assert.AreEqual(TreeTools.CheckDiag.cdStrangeSpouse, checksList[0].Diag);
            Assert.AreEqual(TreeTools.CheckDiag.cdPersonLonglived, checksList[2].Diag);

            Assert.Throws(typeof(ArgumentNullException), () => { TreeTools.RepairProblem(null, null); });
            Assert.Throws(typeof(ArgumentNullException), () => { TreeTools.RepairProblem(fBaseWin, null); });

            TreeTools.RepairProblem(fBaseWin, checksList[2]);
        }
コード例 #4
0
 private void btnBaseRepair_Click(object sender, EventArgs e)
 {
     try
     {
         int num = ListChecks.Items.Count;
         for (int i = 0; i < num; i++)
         {
             GKListItem item  = (GKListItem)ListChecks.Items[i];
             bool       check = (bool)item.Values[0];
             if (check)
             {
                 var checkObj = item.Data as TreeTools.CheckObj;
                 TreeTools.RepairProblem(fBase, checkObj);
             }
         }
     }
     finally
     {
         Base.RefreshLists(false);
         CheckBase();
     }
 }