public void List_NoItemsInArray_HeadersProperlyDisplayed() { IListable[] contacts = {}; string expected = "Header1Header2"; IntelliTect.TestTools.Console.ConsoleAssert.Expect( expected, _ => { ConsoleListControl.List(new[] { "Header1", "Header2" }, contacts); }); }
public void List_HeadersAndItemsNotOfSameLength_ArgumentOutOfRangeException() { IListable[] contacts = { new Contact( "Dick", "Traci", "123 Main St., Spokane, WA 99037", "123-123-1234") }; ConsoleListControl.List(new[] { "Header1", "Header2" }, contacts); }
public static void Main() { Contact[] contacts = new Contact[] { new Contact( "Dick", "Traci", "123 Main St., Spokane, WA 99037", "123-123-1234"), new Contact( "Andrew", "Littman", "1417 Palmary St., Dallas, TX 55555", "555-123-4567"), new Contact( "Mary", "Hartfelt", "1520 Thunder Way, Elizabethton, PA 44444", "444-123-4567"), new Contact( "John", "Lindherst", "1 Aerial Way Dr., Monteray, NH 88888", "222-987-6543"), new Contact( "Pat", "Wilson", "565 Irving Dr., Parksdale, FL 22222", "123-456-7890"), new Contact( "Jane", "Doe", "123 Main St., Aurora, IL 66666", "333-345-6789") }; // Classes are cast implicitly convertible to // their supported interfaces ConsoleListControl.List(Contact.Headers, contacts); Console.WriteLine(); Publication[] publications = new Publication[3] { new Publication( "The End of Poverty: Economic Possibilities for Our Time", "Jeffrey Sachs", 2006), new Publication("Orthodoxy", "G.K. Chesterton", 1908), new Publication( "The Hitchhiker's Guide to the Galaxy", "Douglas Adams", 1979) }; ConsoleListControl.List( Publication.Headers, publications); }
public void List_SingleItemInArrayUsingContactHeaders_ItemProperlyDisplayed() { IListable[] contacts = { new Contact( "Inigo", "Montoya", "123 Main St., Spokane, WA 99037", "123-123-1234") }; const string expected = @"First NameLast Name Phone Address Inigo Montoya 123-123-1234123 Main St., Spokane, WA 99037"; IntelliTect.TestTools.Console.ConsoleAssert.Expect( expected, _ => { ConsoleListControl.List(Contact.Headers, contacts); }); }