示例#1
0
        public void GetCustomers_ShouldReturnCorrectRepo() //Read
        {
            //Arrange
            Customer      customer = new Customer();
            Customer_Repo repo     = new Customer_Repo();

            repo.AddCustomer(customer);

            //Act
            List <Customer> customers            = repo.GetAllCustomers();
            bool            customersHasCustomer = customers.Contains(customer);

            //Assert
            Assert.IsTrue(customersHasCustomer);
        }
示例#2
0
        public void ListView()
        {
            Console.Clear();
            KomodoLogo();
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("=+= Viewing All Customer Entries =+=");
            Console.WriteLine();

            List <Customer> customers = _repo.GetAllCustomers();

            customers.OrderBy(x => x.LastName).ThenBy(x => x.FirstName);
            Console.WriteLine("First Name".PadRight(10) + "Last Name".PadLeft(15) + "Type".PadLeft(15) + "Email".PadLeft(10));
            foreach (Customer customer in customers)
            {
                Console.WriteLine(customer.FirstName.PadRight(15) + customer.LastName.PadLeft(10) + customer.Type.ToString().PadLeft(15) + "     " + customer.Email.PadLeft(10));
                Console.WriteLine();
            }
            Console.WriteLine("Press any key to continue.");
            Console.ReadKey();
        }