public void GetKeys_UniqueCellNumericCasting_CorrectCell() { var table = BuildDataTable(new[] { "Key0", "Key1", "Key0" }, new[] { "Foo", "Bar", "Foo" }, new object[] { "0", "1.0", "0.00" }); var columns = new List <IColumnDefinition>() { new Column() { Identifier = new ColumnOrdinalIdentifier(2), Type = ColumnType.Numeric } }; var keyRetriever = new CellRetrieverByOrdinal(columns); Assert.That(keyRetriever.GetColumns(table.Rows[0]).Members, Is.EqualTo(new[] { 0 })); Assert.That(keyRetriever.GetColumns(table.Rows[1]).Members, Is.EqualTo(new[] { 1 })); Assert.That(keyRetriever.GetColumns(table.Rows[2]).Members, Is.EqualTo(new[] { 0 })); }
public void GetKeys_TwoCells_CorrectCells() { var table = BuildDataTable(new[] { "Key0", "Key1", "Key0" }, new[] { "Foo", "Bar", "Foo" }, new object[] { 0, 1, 0 }); var columns = new List <IColumnDefinition>() { new Column() { Identifier = new ColumnOrdinalIdentifier(0), Type = ColumnType.Text }, new Column() { Identifier = new ColumnOrdinalIdentifier(1), Type = ColumnType.Text } }; var keyRetriever = new CellRetrieverByOrdinal(columns); Assert.That(keyRetriever.GetColumns(table.Rows[0]).Members, Is.EqualTo(new[] { "Key0", "Foo" })); Assert.That(keyRetriever.GetColumns(table.Rows[1]).Members, Is.EqualTo(new[] { "Key1", "Bar" })); Assert.That(keyRetriever.GetColumns(table.Rows[2]).Members, Is.EqualTo(new[] { "Key0", "Foo" })); }