示例#1
0
        public void AddCustomer_ShouldReturnTrue()
        {
            KomodoCustomer customer = new KomodoCustomer(12, "Jones", 30, new DateTime(2000, 10, 3));

            KomodoRepo repo = new KomodoRepo();

            bool addResult = repo.AddCustomer(customer);

            Assert.IsTrue(addResult);
        }
示例#2
0
        public void IsGoldMember_ShouldReturnTrue()
        {
            KomodoCustomer_Repo repo      = new KomodoCustomer_Repo();
            KomodoCustomer      customer1 = new KomodoCustomer(001, "Hambright", new DateTime(1984, 11, 12), new DateTime(2015, 01, 02));
            KomodoCustomer      customer2 = new KomodoCustomer(001, "Smith", new DateTime(1982, 03, 28), new DateTime(2019, 01, 02));


            //repo.MessageCustomers();
            Console.WriteLine("Hello world!");
        }
示例#3
0
        public void DeleteCustomer_ShouldReturnTrue()
        {
            KomodoCustomer customer1 = new KomodoCustomer(12, "Jones", 30, new DateTime(2000, 10, 3));

            KomodoRepo repo = new KomodoRepo();

            repo.AddCustomer(customer1);

            bool wasDeleted = repo.DeleteCustomerInformation(customer1);

            Assert.IsTrue(wasDeleted);
        }
示例#4
0
        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);
        }
示例#5
0
        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);
        }
示例#6
0
        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);
        }
示例#7
0
        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);
        }
示例#8
0
        public void GetCustomers_ShouldGetCorrectCustomerBase()
        {
            KomodoCustomer customer = new KomodoCustomer(12, "Jones", 30, new DateTime(2000, 10, 3));
            KomodoRepo     repo     = new KomodoRepo();

            repo.AddCustomer(customer);

            List <KomodoCustomer> customerBase = repo.GetKomodoCustomers();

            bool hasContent = customerBase.Contains(customer);

            Assert.IsTrue(hasContent);
        }
示例#9
0
        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);
        }
示例#10
0
        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);
        }
示例#11
0
        public void UpdateCustomer_ShouldReturnTrue()
        {
            KomodoCustomer customer1 = new KomodoCustomer(12, "Jones", 30, new DateTime(2000, 10, 3));

            KomodoRepo repo = new KomodoRepo();

            repo.AddCustomer(customer1);

            bool wasUpdated = repo.UpdateCustomerInformation(12, "Smith", 31);

            Assert.AreEqual(customer1.LastName, "Smith");
            Assert.AreEqual(customer1.Age, 31);
            Assert.IsTrue(wasUpdated);
        }
示例#12
0
        public void GetCustomerById_ShouldGetCorrectCustomer()
        {
            KomodoCustomer customer1 = new KomodoCustomer(12, "Jones", 30, new DateTime(2000, 10, 3));
            KomodoCustomer customer2 = new KomodoCustomer(13, "Smith", 25, new DateTime(1995, 8, 2));

            KomodoRepo repo = new KomodoRepo();

            repo.AddCustomer(customer1);
            repo.AddCustomer(customer2);

            KomodoCustomer returnCustomer = repo.GetKomodoCustomerById(13);

            Assert.AreEqual("Smith", returnCustomer.LastName);
        }
示例#13
0
        private void Seed()
        {
            DateTime date = new DateTime(2000, 10, 10);

            KomodoCustomer customerOne   = new KomodoCustomer(1, "Kline", 21, date);
            KomodoCustomer customerTwo   = new KomodoCustomer(2, "Peak", 18, date);
            KomodoCustomer customerThree = new KomodoCustomer(3, "Red", 71, date);
            KomodoCustomer customerFour  = new KomodoCustomer(4, "Green", 43, date);
            KomodoCustomer customerFive  = new KomodoCustomer(5, "Yellow", 90, date);

            _customerRepo.CreateCustomer(customerOne);
            _customerRepo.CreateCustomer(customerTwo);
            _customerRepo.CreateCustomer(customerThree);
            _customerRepo.CreateCustomer(customerFour);
            _customerRepo.CreateCustomer(customerFive);
        }
示例#14
0
        private void AddCustomer()
        {
            Console.Clear();

            KomodoCustomer newCustomer = new KomodoCustomer();

            Console.WriteLine("Enter the last name of the customer:");
            newCustomer.LastName = Console.ReadLine();
            Console.WriteLine("Enter the ID of the customer:");
            newCustomer.IDNumber = int.Parse(Console.ReadLine());
            Console.WriteLine("Enter the age of the customer:");
            newCustomer.Age = int.Parse(Console.ReadLine());
            Console.WriteLine("Enter the Enrollment Date of the customer:");
            newCustomer.EnrollmentDate = DateTime.Parse(Console.ReadLine());

            _customerRepo.CreateCustomer(newCustomer);
        }