Example #1
0
        public void FilterByStockDescriptionTestDataFound()
        {
            //create an instance of the filtered data
            clsStockCollection FilteredStock = new clsStockCollection();
            //var to store the outcome
            Boolean OK = true;

            //apply a stock ID that exists
            FilteredStock.FilterByStockDescription("testing");
            //check that the correct number of records are found
            if (FilteredStock.Count == 2)
            {
                //check that the first record is ID 2044
                if (FilteredStock.StockList[0].StockID != 2050)
                {
                    OK = false;
                }
                //check that the second record is 2063
                if (FilteredStock.StockList[1].StockID != 2063)
                {
                    OK = false;
                }
            }
            else
            {
                OK = false;
            }


            Assert.IsTrue(OK);
        }
        public void FilterByStockDescriptionNoneFound()
        {
            clsStockCollection FilteredStock = new clsStockCollection();

            FilteredStock.FilterByStockDescription("ATI GPU");
            Assert.AreEqual(0, FilteredStock.Count);
        }
        public void FilterByStockDescriptionOK()
        {
            clsStockCollection AllStock      = new clsStockCollection();
            clsStockCollection FilteredStock = new clsStockCollection();

            FilteredStock.FilterByStockDescription("");
            Assert.AreEqual(AllStock.Count, FilteredStock.Count);
        }
Example #4
0
        public void FilterByStockDescriptionNoneFound()
        {
            //create an instance of the filtered data
            clsStockCollection FilteredStockDescription = new clsStockCollection();

            //apply a stock description that doesn't exit
            FilteredStockDescription.FilterByStockDescription("blaaa");
            //test to see that there are no records
            Assert.AreEqual(0, FilteredStockDescription.Count);
        }
Example #5
0
        public void FilterByStockDescriptionOK()
        {
            //create an instance of the class containing unfiltered results
            clsStockCollection AllStock = new clsStockCollection();
            //create an instance of the filtered data
            clsStockCollection FilteredStockDescription = new clsStockCollection();

            //apply a blank string (should return all records)
            FilteredStockDescription.FilterByStockDescription("");
            //test to see that the values are the same
            Assert.AreEqual(AllStock.Count, FilteredStockDescription.Count);
        }
Example #6
0
    protected void btnApply_Click(object sender, EventArgs e)
    {
        //create an instance of the stock collection
        clsStockCollection Stock = new clsStockCollection();

        Stock.FilterByStockDescription(txtFilter.Text);
        lstStockList.DataSource = Stock.StockList;
        //set the name of the primary key#
        lstStockList.DataValueField = "StockID";
        //set the name of the field to display
        lstStockList.DataValueField = "StockDescription";
        //bind the data to the list
        lstStockList.DataBind();
    }
Example #7
0
    protected void btnClear_Click(object sender, EventArgs e)
    {
        //create an instance of the staff collection
        clsStockCollection Stock = new clsStockCollection();

        Stock.FilterByStockDescription("");
        //clear any existing filter
        txtFilter.Text          = "";
        lstStockList.DataSource = Stock.StockList;
        //set the name of the primary key
        lstStockList.DataValueField = "StockID";
        //set the name of the field to display
        lstStockList.DataTextField = "StockDescription";
        //bind the data to the list
        lstStockList.DataBind();
    }