public void UpdateExistingCustomerByLastName_ShouldReturnTrue() { KomodoCustomer_Repo repo = new KomodoCustomer_Repo(); KomodoCustomer oldCustomer = new KomodoCustomer(001, "Hambright", new DateTime(1984, 11, 12), new DateTime(2015, 01, 02)); KomodoCustomer newCustomer = new KomodoCustomer(001, "Hambright", new DateTime(1984, 11, 07), new DateTime(2016, 01, 02)); repo.AddCustomerToDirectory(oldCustomer); bool updateResult = repo.UpdateExistingCustomerByLastName(oldCustomer.LastName, newCustomer); Assert.IsTrue(updateResult); }
public void GetByCustomerID_ShouldReturnCorrectContents() { KomodoCustomer_Repo repo = new KomodoCustomer_Repo(); KomodoCustomer customer = new KomodoCustomer(001, "Hambright", new DateTime(1984, 11, 12), new DateTime(2015, 01, 02)); repo.AddCustomerToDirectory(customer); int id = 001; KomodoCustomer searchResult = repo.GetCustomerByID(id); Assert.AreEqual(searchResult.CustomerID, id); }
public void GetByLastName_ShouldReturnCorrectContents() { KomodoCustomer_Repo repo = new KomodoCustomer_Repo(); KomodoCustomer customer = new KomodoCustomer(001, "Hambright", new DateTime(1984, 11, 12), new DateTime(2015, 01, 02)); repo.AddCustomerToDirectory(customer); string lastname = "Hambright"; KomodoCustomer searchResult = repo.GetCustomerByLastName(lastname); Assert.AreEqual(searchResult.LastName, lastname); }
public void AddToDirectory_ShouldGetCorrectBoolean() { //Arrange KomodoCustomer customer = new KomodoCustomer(); KomodoCustomer_Repo repository = new KomodoCustomer_Repo(); //Act bool addResult = repository.AddCustomerToDirectory(customer); //Assert Assert.IsTrue(addResult); }
public void DeleteExistingContent_ShouldReturnTrue() { KomodoCustomer_Repo repo = new KomodoCustomer_Repo(); KomodoCustomer customer = new KomodoCustomer(001, "Hambright", new DateTime(1984, 11, 12), new DateTime(2015, 01, 02)); repo.AddCustomerToDirectory(customer); KomodoCustomer oldCustomer = repo.GetCustomerByID(001); bool removeResults = repo.DeleteExistingCustomer(oldCustomer); Assert.IsTrue(removeResults); }
public void GetDirectory_ShouldReturnCorrectCollection() { KomodoCustomer customer = new KomodoCustomer(); KomodoCustomer_Repo repository = new KomodoCustomer_Repo(); repository.AddCustomerToDirectory(customer); List <KomodoCustomer> customers = repository.GetContent(); bool directoryHasCustomers = customers.Contains(customer); Assert.IsTrue(directoryHasCustomers); }