private void SeedContentList() { CustomerContent jakeSmith = new CustomerContent("Jake", "Smith", CustomerType.Potential, "We currently have the lowest rates on Helicopter Insurance!", "Jake Smith"); CustomerContent jamesSmith = new CustomerContent("James", "Smith", CustomerType.Current, "Thank you for your work with us. We appreciate your loyalty. Here's a coupon.", "James Smith"); CustomerContent janeSmith = new CustomerContent("Jane", "Smith", CustomerType.Past, "It's been a long time since we've heard from you, we want you back.", "Jane Smith"); _testRepo.AddContentToList(jakeSmith); _testRepo.AddContentToList(jamesSmith); _testRepo.AddContentToList(janeSmith); }
public void AddCustomerContentTest() // ADD CUSTOMER TO EMAIL LIST TEST { //ARRANGE CustomerContent content = new CustomerContent(); GreetingRepository repo = new GreetingRepository(); List <CustomerContent> localList = repo.GetContentList(); // ACT int beforeCount = localList.Count; repo.AddContentToList(content); int actual = localList.Count; int expected = beforeCount + 1; //Assert Assert.AreEqual(expected, actual); }
private void CreateNewContent() // CREATE NEW CUSTOMER CONTENT { Console.Clear(); CustomerContent newContent = new CustomerContent(); Console.WriteLine("Enter customer first name:"); newContent.FirstName = Console.ReadLine(); Console.WriteLine("Enter customer last name:"); newContent.LastName = Console.ReadLine(); Console.WriteLine("Enter customer type (1-3):\n" + "1) Current\n" + "2) Past\n" + "3) Potential"); string typeAsString = Console.ReadLine(); int typeAsInt = int.Parse(typeAsString); newContent.TypeOfCustomer = (CustomerType)typeAsInt; Console.WriteLine("\nEmail text for this customer:"); if (typeAsInt == 1) { Console.WriteLine("Thank you for your work with us. We appreciate your loyalty. Here's a coupon."); newContent.Email = "Thank you for your work with us. We appreciate your loyalty. Here's a coupon."; } else if (typeAsInt == 2) { Console.WriteLine("It's been a long time since we've heard from you, we want you back."); newContent.Email = "It's been a long time since we've heard from you, we want you back."; } else if (typeAsInt == 3) { Console.WriteLine("We currently have the lowest rates on Helicopter Insurance!"); newContent.Email = "We currently have the lowest rates on Helicopter Insurance!"; } else { Console.WriteLine("Could not generate email text due to input error."); } _contentRepo.AddContentToList(newContent); bool wasAdded = _contentRepo.AddContentToList(newContent); if (wasAdded) { Console.WriteLine("\nCustomer profile successfully added."); } else { Console.WriteLine("\nCould not add customer profile."); } }
public void UpdateCustomerContentTest() // EDIT CUSTOMER CONTENT TEST { // ARRANGE GreetingRepository repo = new GreetingRepository(); CustomerContent oldContent = new CustomerContent("Gandalf", "Thegrey", CustomerType.Potential, "We currently have the lowest rates on Helicopter Insurance!", "Gandalf Thegrey"); repo.AddContentToList(oldContent); CustomerContent updatedcontent = new CustomerContent("Tom", "Bombadill", CustomerType.Past, "It's been a long time since we've heard from you, we want you back.", "Tom Bombadill"); string name = "gandalf thegrey"; //ACT bool result = repo.UpdateCustomerContent(name, updatedcontent); //ASSERT Assert.IsTrue(result); }