Exemple #1
0
        public static void ADOCanAddCustomer()
        {
            Customers customerToAdd = new Customers();
            var       repo          = new CustomersRepositoryADO();

            customerToAdd.StateId           = "IL";
            customerToAdd.CustomerFirstName = "Sally";
            customerToAdd.CustomerLastName  = "Rogers";
            customerToAdd.CustomerPhone     = "333-333-3333";
            customerToAdd.CustomerEmail     = "sallyrogers @test3.com";
            customerToAdd.CustomerStreet1   = "Test3 Street1";
            customerToAdd.CustomerStreet2   = "";
            customerToAdd.CustomerCity      = "Test 3 City";
            customerToAdd.CustomerZipCode   = "33333";


            repo.AddCustomer(customerToAdd);
            var customers = repo.GetAllCustomers().ToList();

            Assert.IsNotNull(customers[4]);
            Assert.AreEqual(5, customers.Count);

            Assert.AreEqual(5, customers[4].CustomerId);
            Assert.AreEqual("IL", customers[4].StateId);
            Assert.AreEqual("Sally", customers[4].CustomerFirstName);
            Assert.AreEqual("Rogers", customers[4].CustomerLastName);
            Assert.AreEqual("333-333-3333", customers[4].CustomerPhone);
            Assert.AreEqual("sallyrogers @test3.com", customers[4].CustomerEmail);
            Assert.AreEqual("Test3 Street1", customers[4].CustomerStreet1);
            Assert.AreEqual("", customers[4].CustomerStreet2);
            Assert.AreEqual("Test 3 City", customers[4].CustomerCity);
            Assert.AreEqual("33333", customers[4].CustomerZipCode);
        }
Exemple #2
0
        public void ADOCanLoadCustomers()
        {
            var repo = new CustomersRepositoryADO();

            var customers = repo.GetAllCustomers();

            Assert.AreEqual(4, customers.Count);
            Assert.AreEqual(2, customers[1].CustomerId);
            Assert.AreEqual("MO", customers[1].StateId);
            Assert.AreEqual("Joe", customers[1].CustomerFirstName);
            Assert.AreEqual("Baker", customers[1].CustomerLastName);
            Assert.AreEqual("222-222-2222", customers[1].CustomerPhone);
            Assert.AreEqual("*****@*****.**", customers[1].CustomerEmail);
            Assert.AreEqual("Test2 Street1", customers[1].CustomerStreet1);
            Assert.AreEqual("Test2 Street2", customers[1].CustomerStreet2);
            Assert.AreEqual("Test2City", customers[1].CustomerCity);
            Assert.AreEqual("22222", customers[1].CustomerZipCode);
        }