Exemplo n.º 1
0
        public void ViewCustomer()
        {
            Console.Clear();
            KomodoLogo();
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("=+= View Customer =+=");
            Console.WriteLine("Enter customer's full name (First Last)");
            string fullName = Console.ReadLine();

            Console.Clear();
            KomodoLogo();
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine("=+= View Customer =+=");
            Customer customer = new Customer();

            customer = _repo.GetCustomerByFullName(fullName);
            if (customer != null)
            {
                Console.WriteLine("First Name:              " + customer.FirstName);
                Console.WriteLine("Last Name:               " + customer.LastName);
                Console.WriteLine("Customer Type:           " + customer.Type);
                Console.WriteLine("Email Message Preview:   " + customer.Email);
                Console.WriteLine("Press any key to return to main menu.");
            }
            else
            {
                Console.WriteLine("Customer not found");
                Console.WriteLine("Press any key to return to main menu.");
            }
            Console.ReadKey();
        }
Exemplo n.º 2
0
        public void GetCustomerByFullName_ShouldReturnCorrectCustomer() //Read
        {
            //Arrange
            Customer_Repo repo     = new Customer_Repo();
            Customer      customer = new Customer("Hambright", "Josh", CustomerType.Current);

            repo.AddCustomer(customer);
            string fullName = "Josh Hambright";

            //Act
            Customer searchResult = repo.GetCustomerByFullName(fullName);

            //Assert
            Assert.AreEqual(searchResult.FullName, fullName);
        }
Exemplo n.º 3
0
        public void DeleteCustomer_ShouldReturnTrue() //Delete
        {
            //Arrange
            Customer_Repo repo     = new Customer_Repo();
            Customer      customer = new Customer("Hambright", "Josh", CustomerType.Current);

            repo.AddCustomer(customer);
            string fullName = "Josh Hambright";

            //Act
            Customer oldCustomer    = repo.GetCustomerByFullName(fullName);
            bool     removeCustomer = repo.DeleteCustomer(oldCustomer);

            //Assert
            Assert.IsTrue(removeCustomer);
        }