public void AddNewCustomer()
        {
            Console.Clear();
            CustomerContent newContent = new CustomerContent();

            Console.WriteLine("Please enter a first name.");
            newContent.FirstName = Console.ReadLine();
            Console.WriteLine("Please enter a last name.");
            newContent.LastName = Console.ReadLine();
            Console.WriteLine("Please enter a type for this customer.\n" +
                              "1. Potential.\n" +
                              "2. Current.\n" +
                              "3. Past.");
            newContent.Type = Console.ReadLine();
            Console.WriteLine("Please enter message to be sent to customer email.\n" +
                              " A.We currently have the lowest rates on Helicopter Insurance!\n" +
                              " B.Thank you for your work with us. We appreciate your loyalty. Here's a coupon.\n" +
                              " C.It's been a long time since we've heard from you, we want you back");
            newContent.Email = Console.ReadLine();
            bool wasAdded = _repo.AddContentToDirectory(newContent);

            if (wasAdded == true)
            {
                Console.WriteLine("Your content was succesfully added.");
            }
            else
            {
                Console.WriteLine("Oops something went wrong. Your content was not added.");
            }
        }
Exemple #2
0
        public void AddToDirectory_ShouldGetCorrectBoolean()
        {
            CustomerContent      content    = new CustomerContent();
            CustomerContent_Repo repository = new CustomerContent_Repo();

            bool addResult = repository.AddContentToDirectory(content);

            Assert.IsTrue(addResult);
        }
Exemple #3
0
        public void GetDirectory_ShouldReturnCorrectCollection()
        {
            CustomerContent      content = new CustomerContent();
            CustomerContent_Repo repo    = new CustomerContent_Repo();

            repo.AddContentToDirectory(content);

            List <CustomerContent> contents = repo.GetContents();

            bool directoryHasContent = contents.Contains(content);


            Assert.IsTrue(directoryHasContent);
        }
Exemple #4
0
        public void GetByTitle_ShouldReturnCorrectContent()
        {
            //Arrange
            CustomerContent_Repo repo       = new CustomerContent_Repo();
            CustomerContent      newContent = new CustomerContent("Toy Story", "Toys come to life", 10, Genre.Action, MaturityRating.PG);

            repo.AddContentToDirectory(newContent);
            string title = "Toy Story";

            //Act
            CustomerContent searchResult = repo.GetContentByTitle(title);

            //Assert
            Assert.AreEqual(searchResult.Title, title);
        }
Exemple #5
0
        public void DeleteExistingContent_ShouldReturnTrue()
        {
            //Arrange
            CustomerContent_Repo repo    = new CustomerContent_Repo();
            CustomerContent      content = new CustomerContent("Toy Story", "Toys come to life", 10, Genre.Action, MaturityRating.PG);

            repo.AddContentToDirectory(content);

            //Act
            CustomerContent oldcontent = repo.GetContentByTitle("Toy Story");

            bool removeResult = repo.DeleteExistingContent(oldcontent);

            //Assert
            Assert.IsTrue(removeResult);
        }
Exemple #6
0
        public void UpdateExistingContent_ShouldReturnTrue()
        {
            //Arrange
            CustomerContent_Repo repo       = new CustomerContent_Repo();
            CustomerContent      oldContent = new CustomerContent("Toy Story", "Toys come to life", 10, Genre.Action, MaturityRating.PG);

            repo.AddContentToDirectory(oldContent);

            CustomerContent newContent = new CustomerContent("Toy Story", "Toys come to life", 10, Genre.Action, MaturityRating.PG);

            //Act
            bool updateResult = repo.UpdateExistingContent("Toy Story", newContent);

            //Assert
            Assert.IsTrue(updateResult);
        }