Пример #1
0
        public void ReportByRegPlateTestDataFound()
        {
            //create an instance of the filtered data
            clsCarCollection FilteredCars = new clsCarCollection();
            //var to sore outcome
            Boolean Ok = true;

            //apply a reg plate that doesnt exist
            FilteredCars.ReportByRegPlate("cd18hju");
            //check that the correct no of records are found
            if (FilteredCars.Count == 2)
            {
                //check that the first record is ID 4
                if (FilteredCars.CarList[0].CarID != 3)
                {
                    Ok = false;
                }
                //check that the first reocrd is ID 5
                if (FilteredCars.CarList[1].CarID != 193)
                {
                    Ok = false;
                }
            }
            else
            {
                Ok = false;
            }
            //test to see that there are no records
            Assert.IsTrue(Ok);
        }
Пример #2
0
        public void ReportByRegPlateNoneFound()
        {
            //create an instance of the filtered data
            clsCarCollection FilteredCars = new clsCarCollection();

            //apply a post code that doesnt exist
            FilteredCars.ReportByRegPlate("xxxx xxx");
            Assert.AreEqual(0, FilteredCars.Count);
        }
Пример #3
0
        public void ReportByRegPlateMethodOk()
        {
            //create an instance of the class containg unfiltered results
            clsCarCollection AllCars = new clsCarCollection();
            //create an instance of the filtere data
            clsCarCollection FilteredCars = new clsCarCollection();

            //apply a blank string (should return all records)
            FilteredCars.ReportByRegPlate("");
            //test to see that the 2 values are the same
            Assert.AreEqual(AllCars.Count, FilteredCars.Count);
        }
Пример #4
0
    Int32 DisplayFilterRegPlate(string RegPlateFilter)
    {
        Int32            CarID;
        string           RegPlate;
        clsCarCollection CarBook = new clsCarCollection();

        CarBook.ReportByRegPlate(RegPlateFilter);
        Int32 RecordCount;
        Int32 Index = 0;

        RecordCount = CarBook.Count;
        lstCars.Items.Clear();
        while (Index < RecordCount)
        {
            CarID    = CarBook.CarList[Index].CarID;
            RegPlate = CarBook.CarList[Index].RegPlate;
            ListItem NewEntry = new ListItem(RegPlate + "", CarID.ToString());
            lstCars.Items.Add(NewEntry);
            Index++;
        }
        return(RecordCount);
    }