private void ViewAllCustomers() { Console.Clear(); _allCustomers = customerManipulator.GetAllCustomers(); var sorter = _allCustomers.OrderBy(x => x.LastName).ThenBy(x => x.FirstName); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("{0} \t{1} \t{2} \t{3}\n", "First Name".PadRight(10), "Last Name".PadRight(10), "Type".PadRight(10), "Email Template"); foreach (var customer in sorter) { switch (customer.Type) { case CustomerType.Current: Console.ForegroundColor = ConsoleColor.Green; break; case CustomerType.Past: Console.ForegroundColor = ConsoleColor.DarkYellow; break; case CustomerType.Potential: Console.ForegroundColor = ConsoleColor.Cyan; break; } Console.WriteLine("{0} \t{1} \t{2} \t{3}", customer.FirstName.PadRight(10), customer.LastName.PadRight(10), customer.Type.ToString().PadRight(10), customer.EmailToSend); } }
public void TestAddAndReadMethods() { // Arrange (initialize variables) var newCustomer = new Customer("Casey", "McDonough", CustomerType.Current); // Act (add newCustomer to the _customerList field using the Create method customerTester.CreateCustomer(newCustomer); // Assert (that the field of customers is not null, and that the count is greater than 0) var custList = customerTester.GetAllCustomers(); Assert.IsNotNull(custList, "Add failed."); // Also tests the Get/Read method to make sure it reads the field properly Assert.IsTrue(custList.Count > 0, "Add failed."); }
public void GetAllCustomersTest() { IEnumerable <customer> customers = CustomerCRUD.GetAllCustomers(); Assert.AreEqual(customers.Count(), 4); }