コード例 #1
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!");
        }
コード例 #2
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);
        }
コード例 #3
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);
        }
コード例 #4
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);
        }
コード例 #5
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);
        }
コード例 #6
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);
        }
コード例 #7
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);
        }