public void VerifyIfThereIsDifferenceWhenList1HasSixComponentsWithRepetitionWhereOneIsNotInList2() { ListCompare listcompare = new ListCompare(); { String[] array1 = { "3", "7", "3", "1", "1", "0", "9", "9", " 8" }; String[] array2 = { "1", "3", "3", "7", "9", "0", "9", "1" }; bool result = listcompare.VerifyArraysDifferences(array1, array2); Assert.IsTrue(result); } }
public void VerifyIfThereIsNoDifferenceWhenList1HasTwoComponentsThatAreInList2() { ListCompare listcompare = new ListCompare(); { String[] array1 = { "1", "3" }; String[] array2 = { "1", "3", "8" }; bool result = listcompare.VerifyArraysDifferences(array1, array2); Assert.IsFalse(result); } }
public void VerifyIfThereIsDifferenceWhenList1HasTwoComponentsButOnlyOneInList2() { ListCompare listcompare = new ListCompare(); { String[] array1 = { "1", "2" }; String[] array2 = { "1" }; bool result = listcompare.VerifyArraysDifferences(array1, array2); Assert.IsTrue(result); } }
public void VerifyIfThereIsNoDifferenceWhenListAreTheSame() { ListCompare listcompare = new ListCompare(); { String[] array1 = { "1" }; String[] array2 = { "1" }; bool result = listcompare.VerifyArraysDifferences(array1, array2); Assert.IsFalse(result); } }
public void CreateTableForEquipList() { equipList = new List <EquipItemData>(equipItemTable.GetCount()); ForEach(delegate(EquipItemData data) { if (data.CanCollecting()) { equipList.Add(data); } }); ListCompare comparer = new ListCompare(); equipList.Sort(comparer); }
public static IEnumerable <InstallItemDiff> GetDiffs(IEnumerable <InstallItem> left, IEnumerable <InstallItem> right) { var leftList = left.Where(i => i.Type != InstallType.Warning).ToArray(); var rightList = right.Where(i => i.Type != InstallType.Warning).ToArray(); var compares = ListCompare.Create(leftList, rightList, i => i.Reference); var results = new List <InstallItemDiff>(); foreach (var compare in compares) { if (compare.Base < 0) { results.Add(new InstallItemDiff() { _itemRef = rightList[compare.Compare].Reference, _type = rightList[compare.Compare].Type, DiffType = DiffType.RightOnly, RightScript = rightList[compare.Compare].Script }); } else if (compare.Compare < 0) { results.Add(new InstallItemDiff() { _itemRef = leftList[compare.Base].Reference, _type = leftList[compare.Base].Type, DiffType = DiffType.LeftOnly, LeftScript = leftList[compare.Base].Script }); } else { results.Add(new InstallItemDiff() { _itemRef = leftList[compare.Base].Reference, _type = leftList[compare.Base].Type, DiffType = (AmlDiff.IsDifferent(leftList[compare.Base].Script.OuterXml, rightList[compare.Compare].Script.OuterXml) ? DiffType.Different : DiffType.Identical), LeftScript = leftList[compare.Base].Script, RightScript = rightList[compare.Compare].Script }); } } return(results); }
private void btnMatch_Click(object sender, EventArgs e) { TreeMatchType type = GetTreeMatchType(); ListCompare.Clear(); switch (type) { case TreeMatchType.tmtInternal: TreeTools.FindDuplicates(fTree, fTree, 90 /*min: 80-85*/, DuplicateFoundFunc, AppHost.Progress); break; case TreeMatchType.tmtExternal: TreeTools.CompareTree(fBase.Context, external_match_db, ListCompare); break; case TreeMatchType.tmtAnalysis: { List <TreeTools.ULIndividual> uln = TreeTools.GetUnlinkedNamesakes(fBase); ListCompare.AppendText(" " + LangMan.LS(LSID.LSID_SearchUnlinkedNamesakes) + ":\r\n"); if (uln != null && uln.Count > 0) { foreach (TreeTools.ULIndividual indiv in uln) { ListCompare.AppendText(" - [" + indiv.Family + "] " + GKUtils.GetNameString(indiv.IRec, true, false) + "\r\n"); } } else { ListCompare.AppendText(" - not found."); } break; } } }
private void DuplicateFoundFunc(GEDCOMIndividualRecord indivA, GEDCOMIndividualRecord indivB) { ListCompare.AppendText(" * [" + GKUtils.GetNameString(indivA, true, false) + "]\r\n"); ListCompare.AppendText(" [" + GKUtils.GetNameString(indivB, true, false) + "]\r\n\r\n"); }
private DiffType GetDiffType(ListCompare compare) { if (compare.Base < 0) return DiffType.Add; if (compare.Compare < 0) return DiffType.Delete; if (compare.IsDifferent) return DiffType.Change; return DiffType.Normal; }