public void SingleResult_YieldsThatResult() { var dataTable = new DataTable(); dataTable.Columns.Add("Result", typeof(string)); dataTable.Rows.Add("Some Value"); var formatter = new ConsoleTableFormatter(120, " | "); var result = formatter.Format(dataTable).ToList(); Assert.AreEqual("Some Value", result.Single()); }
public void EmptyDataTable_YieldsEmpty() { var dataTable = new DataTable(); var formatter = new ConsoleTableFormatter(120, " | "); var result = string.Join(Environment.NewLine, formatter.Format(dataTable)); var expected = ""; Assert.AreEqual(expected, result); }
public void Format_WhenWindowWidthIsNotWideEnough() { var dataTable = new[] { new Person {Id = 1, FirstName = "John", LastName = "Doe"} }.ToDataTable(); var formatter = new ConsoleTableFormatter(20, " | "); var result = string.Join(Environment.NewLine, formatter.Format(dataTable)); var expected = "Id | FirstName | La\r\n" + "---|-----------|---\r\n" + "1 | John | Do"; Assert.AreEqual(expected, result); }