public void ToDataTable() { List <PreDataTable> Temp = new PreDataTable[] { new PreDataTable { ID = 1, Value = "A" }, new PreDataTable { ID = 2, Value = "B" }, new PreDataTable { ID = 3, Value = "C" } }.ToList(); Assert.DoesNotThrow(() => Temp.ToDataTable()); DataTable Temp2 = Temp.ToDataTable(); Assert.Equal(1, Temp2.Rows[0].ItemArray[0]); Assert.Equal("A", Temp2.Rows[0].ItemArray[1]); Assert.Equal(2, Temp2.Rows[1].ItemArray[0]); Assert.Equal("B", Temp2.Rows[1].ItemArray[1]); Assert.Equal(3, Temp2.Rows[2].ItemArray[0]); Assert.Equal("C", Temp2.Rows[2].ItemArray[1]); }
public void ToList() { List <PreDataTable> Temp = new PreDataTable[] { new PreDataTable { ID = 1, Value = "A" }, new PreDataTable { ID = 2, Value = "B" }, new PreDataTable { ID = 3, Value = "C" } }.ToList(); List <PreDataTable> Temp2 = Temp.ToDataTable().ToList <PreDataTable>(); Assert.Equal(Temp, Temp2); }
public void ToList() { List<PreDataTable> Temp = new PreDataTable[] { new PreDataTable { ID = 1, Value = "A" }, new PreDataTable { ID = 2, Value = "B" }, new PreDataTable { ID = 3, Value = "C" } }.ToList(); List<PreDataTable> Temp2 = Temp.ToDataTable().ToList<PreDataTable>(); Assert.Equal(Temp, Temp2); }
public void ToDataTable() { List<PreDataTable> Temp = new PreDataTable[] { new PreDataTable { ID = 1, Value = "A" }, new PreDataTable { ID = 2, Value = "B" }, new PreDataTable { ID = 3, Value = "C" } }.ToList(); Assert.DoesNotThrow<Exception>(() => Temp.ToDataTable()); DataTable Temp2 = Temp.ToDataTable(); Assert.Equal(1, Temp2.Rows[0].ItemArray[0]); Assert.Equal("A", Temp2.Rows[0].ItemArray[1]); Assert.Equal(2, Temp2.Rows[1].ItemArray[0]); Assert.Equal("B", Temp2.Rows[1].ItemArray[1]); Assert.Equal(3, Temp2.Rows[2].ItemArray[0]); Assert.Equal("C", Temp2.Rows[2].ItemArray[1]); }