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]); }
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(); } }
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]); }
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(); } }