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() { Index = 2, Type = ColumnType.Numeric } }; var keyRetriever = new KeysRetrieverByIndex(columns); Assert.That(keyRetriever.GetKeys(table.Rows[0]).Members, Is.EqualTo(new[] { 0 })); Assert.That(keyRetriever.GetKeys(table.Rows[1]).Members, Is.EqualTo(new[] { 1 })); Assert.That(keyRetriever.GetKeys(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() { Index = 0, Type = ColumnType.Text }, new Column() { Index = 1, Type = ColumnType.Text } }; var keyRetriever = new KeysRetrieverByIndex(columns); Assert.That(keyRetriever.GetKeys(table.Rows[0]).Members, Is.EqualTo(new[] { "Key0", "Foo" })); Assert.That(keyRetriever.GetKeys(table.Rows[1]).Members, Is.EqualTo(new[] { "Key1", "Bar" })); Assert.That(keyRetriever.GetKeys(table.Rows[2]).Members, Is.EqualTo(new[] { "Key0", "Foo" })); }