Пример #1
0
    private void Page_Load(object sender, System.EventArgs e)
    {
        customer = (Customer)(Session["Customer"]);

        if (customer != null)
        {
            orders = OrderData.FindOrdersByCustomerID(customer.CustomerID);
        }
    }
        public void TestFindOrdersByCustomerID()
        {
            ArrayList foundOrders = OrderData.FindOrdersByCustomerID(customerID);

            Assert.IsNotNull(foundOrders, "Found orders object was null, gasp!");
            Assert.IsTrue(foundOrders.Count > 0, "Orders array was empty.");

            if ((foundOrders != null) && (foundOrders.Count > 0))
            {
                Assert.AreEqual(customerID, ((Order)foundOrders[0]).CustomerID, "Customer IDs don't match, gasp!");
                Assert.AreEqual(orderDate, ((Order)foundOrders[0]).OrderDate, "Order dates don't match, gasp!");
                Assert.AreEqual(shipDate, ((Order)foundOrders[0]).ShipDate, "Ship dates don't match, gasp!");
                Assert.AreEqual(userName, ((Order)foundOrders[0]).ShipName, "User names don't match, gasp!");
                Assert.AreEqual(address, ((Order)foundOrders[0]).ShipAddress, "Address don't match, gasp!");
                Assert.AreEqual(city, ((Order)foundOrders[0]).ShipCity, "Cities don't match, gasp!");
                Assert.AreEqual(postalCode, ((Order)foundOrders[0]).ShipPostalCode, "Postal codes don't match, gasp!");
                Assert.AreEqual(country, ((Order)foundOrders[0]).ShipCountry, "Countries don't match, gasp!");
            }
        }