Beispiel #1
0
        public void CanLoadContacts()
        {
            var repo = new ContactUsRepositoryADO();

            var contacts = repo.GetAll();

            Assert.AreEqual(3, contacts.Count());

            Assert.AreEqual(1, contacts[0].ContactUsId);
            Assert.AreEqual("Person1", contacts[0].ContactName);
            Assert.AreEqual("*****@*****.**", contacts[0].Email);
            Assert.AreEqual("111-111-1111", contacts[0].Phone);
            Assert.AreEqual("Message1", contacts[0].ContactMessage);
        }
Beispiel #2
0
        public void ADOCanGetAllContacts()
        {
            var repo = new ContactUsRepositoryADO();

            var contacts = repo.GetAllContactRequests();

            Assert.AreEqual(2, contacts.Count);
            Assert.AreEqual(2, contacts[1].ContactUsId);
            Assert.AreEqual("John", contacts[1].ContactUsFirstName);
            Assert.AreEqual("Smith", contacts[1].ContactUsLastName);
            Assert.AreEqual("*****@*****.**", contacts[1].ContactUsEmail);
            Assert.AreEqual("222-222-2222", contacts[1].ContactUsPhone);
            Assert.AreEqual("Test2 Lorem ipsum dolor sit amet, consectetur adipiscing elit.", contacts[1].ContactUsMessage);
        }
Beispiel #3
0
        public static void ADOCanAddContact()
        {
            ContactUs contactToAdd = new ContactUs();
            var       repo         = new ContactUsRepositoryADO();

            contactToAdd.ContactUsFirstName = "Sally";
            contactToAdd.ContactUsLastName  = "Rogers";
            contactToAdd.ContactUsEmail     = "*****@*****.**";
            contactToAdd.ContactUsPhone     = "333-333-3333";
            contactToAdd.ContactUsMessage   = "Test3 Lorem ipsum dolor sit amet, consectetur adipiscing elit.";

            repo.AddContact(contactToAdd);
            var contacts = repo.GetAllContactRequests().ToList();

            Assert.IsNotNull(contacts[2]);
            Assert.AreEqual(3, contacts.Count);

            Assert.AreEqual(3, contacts[2].ContactUsId);
            Assert.AreEqual("Sally", contacts[2].ContactUsFirstName);
            Assert.AreEqual("Rogers", contacts[2].ContactUsLastName);
            Assert.AreEqual("*****@*****.**", contacts[2].ContactUsEmail);
            Assert.AreEqual("333-333-3333", contacts[2].ContactUsPhone);
            Assert.AreEqual("Test3 Lorem ipsum dolor sit amet, consectetur adipiscing elit.", contacts[2].ContactUsMessage);
        }