Пример #1
0
        public void SeedCustomers()
        {
            //Seed Customers for Testing

            Customer customer1 = new Customer("Smith", "Jake", CustomerType.Potential);
            Customer customer2 = new Customer("Smith", "James", CustomerType.Current);
            Customer customer3 = new Customer("Smith", "Jane", CustomerType.Past);

            _repo.AddCustomer(customer1);
            _repo.AddCustomer(customer2);
            _repo.AddCustomer(customer3);
        }
Пример #2
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);
        }
Пример #3
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);
        }
Пример #4
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);
        }
Пример #5
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);
        }
Пример #6
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);
        }