Пример #1
0
        public void AddToRepo_ShouldReturnCorrectBool() //Create
        {
            //Arrange
            Customer      customer = new Customer();
            Customer_Repo repo     = new Customer_Repo();
            //Act
            bool wasAdded = repo.AddCustomer(customer);

            //Assert
            Assert.IsTrue(wasAdded);
        }
Пример #2
0
        public void UpdateExistingCustomer_ShouldReturnTrue()//Update
        {
            //Arrange
            Customer_Repo repo     = new Customer_Repo();
            Customer      customer = new Customer("Hambright", "Josh", CustomerType.Current);

            repo.AddCustomer(customer);
            Customer newCustomer = new Customer("Hambright", "Josh", CustomerType.Potential);

            //Act
            bool updateResult = repo.UpdateExistingCustomer(customer.FullName, newCustomer);

            //Assert
            Assert.IsTrue(updateResult);
        }
Пример #3
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);
        }
Пример #4
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);
        }
Пример #5
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);
        }