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(); }
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); }
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); }