public void GuessType_EmptyRows_ReturnsTextType() { var dt = new DataTable(); dt.Columns.Add("column"); dt.Rows.Add(""); dt.Rows.Add(""); dt.Rows.Add(""); var typeGuesser = new ColumnTypeGuesser(dt); Assert.That(typeGuesser.GuessType(0), Is.EqualTo(DataType.System_Text)); }
public void GuessType_NumericRows_ReturnsTypeNumeric() { var dt = new DataTable(); dt.Columns.Add("column"); dt.Rows.Add(1); dt.Rows.Add(long.MaxValue); dt.Rows.Add(""); var typeGuesser = new ColumnTypeGuesser(dt); Assert.That(typeGuesser.GuessType(0), Is.EqualTo(DataType.System_Numeric)); }
public void GuessType_DateTimeRows_ReturnsTypeDate() { var dt = new DataTable(); dt.Columns.Add("column"); dt.Rows.Add(DateTime.Now); dt.Rows.Add(DateTime.Now.Subtract(DateTime.Now.AddDays(7))); dt.Rows.Add(""); var typeGuesser = new ColumnTypeGuesser(dt); Assert.That(typeGuesser.GuessType(0), Is.EqualTo(DataType.System_Date)); }
public void GuessType_BoolRows_ReturnsTypeBool() { var dt = new DataTable(); dt.Columns.Add("column"); dt.Rows.Add(false); dt.Rows.Add(true); dt.Rows.Add(""); var typeGuesser = new ColumnTypeGuesser(dt); Assert.That(typeGuesser.GuessType(0), Is.EqualTo(DataType.System_Bool)); }