public void ReturnsRowsThatDifferInMultipleColumns() { var table1 = new MemoryTable(new[] { new[] { "A", "B" }, new[] { "1", "0" }, new[] { "1", "2" }, new[] { "1", "4" }, new[] { "1", "6" }, new[] { "1", "8" }, }); var table2 = new MemoryTable(new[] { new[] { "A", "B" }, new[] { "1", "2" }, new[] { "2", "0" }, new[] { "1", "0" }, }); var sut = new TableComparer(new[] { "A", "B" }); var result = sut.Compare(table1, table2); Assert.AreEqual(3, result.RowCount); CollectionAssert.AreEqual(new[] { "1", "4" }, result.Data[0]); CollectionAssert.AreEqual(new[] { "1", "6" }, result.Data[1]); CollectionAssert.AreEqual(new[] { "1", "8" }, result.Data[2]); }
private static void Main(string[] args) { if (args.Length < 3) { Console.WriteLine("Syntax: CompareExcelFiles file1 file2 column [column...]"); Console.WriteLine(" file1 first file to compare"); Console.WriteLine(" file2 second file to compare"); Console.WriteLine(" column name of column(s) to sort / compare by"); return; } var excel = new ExcelLoader(); var table1 = excel.Load(args[0]); var table2 = excel.Load(args[1]); var columns = args.Skip(2).ToArray(); var comparer = new TableComparer(columns); var diff1 = comparer.Compare(table1, table2); var diff2 = comparer.Compare(table2, table1); DumpResult(1, args[0], diff1, table1.RowCount, columns); DumpResult(2, args[1], diff2, table2.RowCount, columns); }
public void ReturnsAllRowsWhenTheOtherTableIsEmpty() { var table1 = new MemoryTable(new[] { new[] { "A", "B" }, new[] { "1", "2" }, new[] { "3", "4" } }); var table2 = new MemoryTable(new[] { new[] { "A", "B" } }); var sut = new TableComparer(new[] { "A" }); var result = sut.Compare(table1, table2); Assert.AreEqual(2, result.RowCount); }