Exemplo n.º 1
0
        public void ReportByShippingAddressNoneFound()
        {
            clsOrderCollection FilteredOrders = new clsOrderCollection();

            FilteredOrders.ReportByShippingAddress("xxx");
            Assert.AreEqual(0, FilteredOrders.Count);
        }
Exemplo n.º 2
0
        public void ReportByShippingAddressTestDataFound()
        {
            //Create an instance of the filtered data
            clsOrderCollection FilteredOrders = new clsOrderCollection();
            //Var to store outcome
            Boolean OK = true;

            //Apply a shipping address that doesn't exist
            FilteredOrders.ReportByShippingAddress("yyy");
            //Check that the correct number of records are found
            if (FilteredOrders.Count == 2)
            {
                //Check that the first record is ID 57
                if (FilteredOrders.OrderList[0].OrderId != 57)
                {
                    OK = false;
                }
                //Check that the second record is ID 58
                if (FilteredOrders.OrderList[1].OrderId != 58)
                {
                    OK = false;
                }
            }
            else
            {
                OK = false;
            }
            //Test to see that there are no records
            Assert.IsTrue(OK);
        }
Exemplo n.º 3
0
        public void ReportByShippingAddressMethodOK()
        {
            clsOrderCollection AllOrders      = new clsOrderCollection();
            clsOrderCollection FilteredOrders = new clsOrderCollection();

            FilteredOrders.ReportByShippingAddress("");
            Assert.AreEqual(AllOrders.Count, FilteredOrders.Count);
        }
Exemplo n.º 4
0
    protected void btnClear_Click(object sender, EventArgs e)
    {
        clsOrderCollection Orders = new clsOrderCollection();

        Orders.ReportByShippingAddress("");
        lstOrderList.DataSource     = Orders.OrderList;
        lstOrderList.DataValueField = "OrderID";
        lstOrderList.DataTextField  = "ShippingAddress";
        lstOrderList.DataBind();
    }
Exemplo n.º 5
0
        public void ReportByShippingAddressNoneFound()
        {
            //Create an instance of the filtered data
            clsOrderCollection FilteredOrders = new clsOrderCollection();

            //Apply a description that doesn't exist
            FilteredOrders.ReportByShippingAddress("xxxx");
            //Test to see that there are no records
            Assert.AreEqual(0, FilteredOrders.Count);
        }
Exemplo n.º 6
0
        public void ReportByShippingAddressMethodOK()
        {
            //Create an instance of the class containing unfiltered results
            clsOrderCollection AllOrders = new clsOrderCollection();
            //Create an instance of the filtered data
            clsOrderCollection FilteredOrders = new clsOrderCollection();

            //Apply a blank string (should return all records)
            FilteredOrders.ReportByShippingAddress("");
            //Test to see that the two values are the same
            Assert.AreEqual(AllOrders.Count, FilteredOrders.Count);
        }
Exemplo n.º 7
0
    protected void btnApply_Click(object sender, EventArgs e)
    {
        //Create an instance of the order collection
        clsOrderCollection Orders = new clsOrderCollection();

        Orders.ReportByShippingAddress(txtFilter.Text);
        lstOrders.DataSource = Orders.OrderList;
        //Set the name of the primary key
        lstOrders.DataValueField = "OrderId";
        //Set the name of the field to display
        lstOrders.DataTextField = "ShippingAddress";
        //Bind the data to the list
        lstOrders.DataBind();
    }
Exemplo n.º 8
0
        public void ReportByShippingAddressTestDataFound()
        {
            clsOrderCollection FilteredOrders = new clsOrderCollection();
            Boolean            OK             = true;

            FilteredOrders.ReportByShippingAddress("TestData1");
            if (FilteredOrders.Count == 2)
            {
                if (FilteredOrders.OrderList[0].OrderID != 39)
                {
                    OK = false;
                }
                if (FilteredOrders.OrderList[1].OrderID != 40)
                {
                    OK = false;
                }
            }
            else
            {
                OK = false;
            }
            Assert.IsTrue(OK);
        }