public void Given_source_and_target_collection_has_one_name_that_the_second_name_contains_Then_both_are_added_to_equal_rows() { var compareColumn = new List <string> { "Name" }; var rows = new List <Row> { new Row { new Column("Name", "Foo Bar") }, new Row { new Column("Name", "Foo Barr") } }; var sourceCollection = new RowCollection(rows) { ColumnHeadersToCompare = compareColumn }; var targetCollection = new RowCollection(rows) { ColumnHeadersToCompare = compareColumn }; var comparisonResult = new RowCollectionComparer().GetCollectionComparisonResult(sourceCollection, targetCollection); comparisonResult.EqualRows.ShouldAllBeEquivalentTo(rows); }
private RowCollectionComparisonResult CompareFiles() { _sourceRowCollection.ColumnHeadersToCompare = SourceColumnsCheckList.CheckedItems.Cast<string>().ToList(); _targetRowCollection.ColumnHeadersToCompare = TargetColumnsCheckList.CheckedItems.Cast<string>().ToList(); var comparer = new RowCollectionComparer(_sourceRowCollection, _targetRowCollection); return comparer.GetCollectionComparisonResult(); }
public void Test() { CheckFilesExist(); var csvRowCollection = ReadRowCollection(CsvFileWithHeadersPath); var excelRowCollection = ReadRowCollection(ExcelFileWithHeadersPath); csvRowCollection.Should().NotBeEmpty(); excelRowCollection.Should().NotBeEmpty(); var compareTwoFields = new List <string> { "First name", "Last name" }; var compareOneField = new List <string> { "Name" }; csvRowCollection.ColumnHeadersToCompare = compareTwoFields; excelRowCollection.ColumnHeadersToCompare = compareOneField; var rowComparer = new RowCollectionComparer(); var result = rowComparer.GetCollectionComparisonResult(csvRowCollection, excelRowCollection); result.NewRows.ShouldAllBeEquivalentTo(new List <Row> { new Row { new Column("Nr", "2"), new Column("Name", "New name"), new Column("Address", "Test street 123") } }); result.DeletedRows.ShouldAllBeEquivalentTo(new List <Row> { new Row { new Column("ID", "12"), new Column("First name", "Deleted"), new Column("Last name", "Name"), new Column("Address", "Hell 109") }, new Row { new Column("ID", "10"), new Column("First name", "John"), new Column("Last name", "Doe"), new Column("Address", "Not happy road 32") }, }); }
public void Test() { CheckFilesExist(); var csvRowCollection = ReadRowCollection(CsvFileWithHeadersPath); var excelRowCollection = ReadRowCollection(ExcelFileWithHeadersPath); csvRowCollection.Should().NotBeEmpty(); excelRowCollection.Should().NotBeEmpty(); var compareTwoFields = new List<string> { "First name", "Last name" }; var compareOneField = new List<string> { "Name" }; csvRowCollection.ColumnHeadersToCompare = compareTwoFields; excelRowCollection.ColumnHeadersToCompare = compareOneField; var rowComparer = new RowCollectionComparer(csvRowCollection, excelRowCollection); var result = rowComparer.GetCollectionComparisonResult(); result.NewRows.ShouldAllBeEquivalentTo(new List<Row> { new Row { new Column("Nr", "2"), new Column("Name", "New name"), new Column("Address", "Test street 123") } }); result.DeletedRows.ShouldAllBeEquivalentTo(new List<Row> { new Row { new Column("ID", "12"), new Column("First name", "Deleted"), new Column("Last name", "Name"), new Column("Address", "Hell 109") }, new Row { new Column("ID", "10"), new Column("First name", "John"), new Column("Last name", "Doe"), new Column("Address", "Not happy road 32") }, }); }
public void Given_source_and_target_collection_has_one_name_that_the_second_name_contains_Then_both_are_added_to_equal_rows() { var compareColumn = new List<string> {"Name"}; var rows = new List<Row> { new Row { new Column("Name", "Foo Bar") }, new Row { new Column("Name", "Foo Barr") } }; var sourceCollection = new RowCollection(rows) {ColumnHeadersToCompare = compareColumn}; var targetCollection = new RowCollection(rows) {ColumnHeadersToCompare = compareColumn}; var comparisonResult = new RowCollectionComparer(sourceCollection, targetCollection).GetCollectionComparisonResult(); comparisonResult.EqualRows.ShouldAllBeEquivalentTo(rows); }