public void ReportByItemNameFound()
        {
            //create an instance of the filtered data
            clsOrderCollection FilteredOrders = new clsOrderCollection();
            //var to store outcome
            Boolean OK = true;

            //apply an item name that doesn't exist
            FilteredOrders.ReportByItemName("Falcon");
            if (FilteredOrders.Count == 2)
            {
                //check the first record is ID 41
                if (FilteredOrders.OrderList[0].OrderId != 41)
                {
                    OK = false;
                }
                //check the second record is ID 42
                if (FilteredOrders.OrderList[1].OrderId != 42)
                {
                    OK = false;
                }
            }
            else
            {
                OK = false;
            }
            //test to see that there are no records
            Assert.IsTrue(OK);
        }
        public void ReportByItemNameNotFound()
        {
            //create an instance of the filtered data
            clsOrderCollection FilteredItemName = new clsOrderCollection();

            //apply an item name that doesn't exist
            FilteredItemName.ReportByItemName("Lol");
            //test to see they are equal
            Assert.AreEqual(0, FilteredItemName.Count);
        }
        public void ReportByItemNameMethodOK()
        {
            //create an instance of the class with unfiltered results
            clsOrderCollection AllOrders = new clsOrderCollection();
            //create an instance of the filtered data
            clsOrderCollection FilteredItemName = new clsOrderCollection();

            //apply a blank string (should return all records)
            FilteredItemName.ReportByItemName("");
            //test to see the values are the same
            Assert.AreEqual(AllOrders.Count, FilteredItemName.Count);
        }
Esempio n. 4
0
    protected void btnApply_Click(object sender, EventArgs e)
    {
        //create an instance of the ItemCollection
        clsOrderCollection Orders = new clsOrderCollection();

        Orders.ReportByItemName(txtItemNameFilter.Text);
        lstOrderList.DataSource = Orders.OrderList;
        //set the name of the primary key
        lstOrderList.DataValueField = "OrderId";
        //set the name of the field to display
        lstOrderList.DataTextField = "ItemName";
        //bind the data to the list
        lstOrderList.DataBind();
    }
Esempio n. 5
0
    protected void btnClear_Click(object sender, EventArgs e)
    {
        //create an instance of the ItemCollection
        clsOrderCollection Orders = new clsOrderCollection();

        Orders.ReportByItemName("");
        //clear any existing filter to tidy up the interface
        txtItemNameFilter.Text  = "";
        lstOrderList.DataSource = Orders.OrderList;
        //set the name of the primary key
        lstOrderList.DataValueField = "OrderId";
        //set the name of the field to display
        lstOrderList.DataTextField = "ItemName";
        //bind the data to the list
        lstOrderList.DataBind();
    }