public void ReportByMakeTestDataFound()
        {
            //create an instacne of the filterd data
            ClsCarCollection FilteredCars = new ClsCarCollection();
            //var to store the outcome
            Boolean OK = true;

            //apply a make that doesn't exist
            FilteredCars.ReportByMake("XXXX");
            //check that the correct number of records are found
            if (FilteredCars.Count == 2)
            {
                //check if the first record is carid 6
                if (FilteredCars.CarList[0].CarID != 6)
                {
                    OK = false;
                }
                //check thet the first record is ID 8
                if (FilteredCars.CarList[1].CarID != 8)
                {
                    OK = false;
                }
            }
            else
            {
                OK = false;
            }
            //test to see that there are no records
            Assert.IsTrue(OK);
        }
        public void ReportByMakeNoneFound()
        {
            //create an instacne of the filtered data
            ClsCarCollection FilteredCars = new ClsCarCollection();

            //apply a make that does not exsist
            FilteredCars.ReportByMake("XXXXXX");
            //test to see that there are no records
            Assert.AreEqual(0, FilteredCars.Count);
        }
        public void ReportByMakeMethodOK()
        {
            //creat an instance of the class containing the unfiltered results
            ClsCarCollection AllCars = new ClsCarCollection();
            //create an instacne of the filtered data
            ClsCarCollection FilteredCars = new ClsCarCollection();

            //apply a blank string (should return all the records)
            FilteredCars.ReportByMake("");
            //test to see that the 2 values are the same
            Assert.AreEqual(AllCars.Count, FilteredCars.Count);
        }
Esempio n. 4
0
    protected void btnApply_Click(object sender, EventArgs e)
    {
        //create an instacne of the car collection
        ClsCarCollection AllCars = new ClsCarCollection();

        AllCars.ReportByMake(txtFilter.Text);
        lstCarList.DataSource = AllCars.CarList;
        //set the name of th epriamry key
        lstCarList.DataValueField = "CarID";
        //set the name of the field to display
        lstCarList.DataTextField = "Make";
        //bind the data to the list
        lstCarList.DataBind();
    }
Esempio n. 5
0
    protected void btnClear_Click(object sender, EventArgs e)
    {
        //create an instanc eof the car collection
        ClsCarCollection AllCars = new ClsCarCollection();

        AllCars.ReportByMake("");
        //clear an y exsitin gfilter to tidy up the interface
        txtFilter.Text        = "";
        lstCarList.DataSource = AllCars.CarList;
        //set the name of th epriamry key
        lstCarList.DataValueField = "CarID";
        //set the name of the field to display
        lstCarList.DataTextField = "Make";
        //bind the data to the list
        lstCarList.DataBind();
    }