Пример #1
0
        public void ReportByDateOFBirthTestDataFound()
        {
            //create an instance of the filtered data
            clsFlightCollection FilteredFlight = new clsFlightCollection();
            //var to store outcome
            Boolean OK = true;

            //apply a name that doesnt exist
            FilteredFlight.ReportByDateOfBirth("June 2020");
            //check that the correct number of records are found
            if (FilteredFlight.Count == 2)
            {
                //check of the record is ID 8
                if (FilteredFlight.FlightList[0].FlightID != 20)
                {
                    OK = false;
                }
                //check that the first record is ID 10
                if (FilteredFlight.FlightList[1].FlightID != 22)
                {
                    OK = false;
                }
            }
            else
            {
                OK = false;
            }
            //test to see that there are no records
            Assert.IsTrue(OK);
        }
    Int32 DisplayFlight(string DateOfBirthFilter)
    {
        //var to store the Dateofbirth
        string DateOfBirth;
        //create an instance of the Orderline collection class
        clsFlightCollection Flight = new clsFlightCollection();

        Flight.ReportByDateOfBirth(DateOfBirthFilter);
        //var to store the count of records
        Int32 RecordCount;
        //var to store the index for the loop
        Int32 Index = 0;

        //get the count of records
        RecordCount = Flight.Count;
        //clear the list box
        lstFlight.Items.Clear();
        //while there are records
        while (Index < RecordCount)
        {
            //get the Dateofbirth
            DateOfBirth = Flight.FlightList[Index].DateOfBirth;
            //create a new entry for the list box
            ListItem NewEntry = new ListItem(DateOfBirth + " ".ToString());
            //add the staff to the list
            lstFlight.Items.Add(NewEntry);
            //move the index to the next record
            Index++;
        }
        //return to the count of records found
        return(RecordCount);
    }
Пример #3
0
        public void ReportByDateOfBirthNoneFound()
        {
            //create an instance of the filtered data
            clsFlightCollection FilteredFlight = new clsFlightCollection();

            //apply a date of birth that doesnt exist
            FilteredFlight.ReportByDateOfBirth("xxx xxxx xxxx");
            //test to see that there are no records
            Assert.AreEqual(0, FilteredFlight.Count);
        }
Пример #4
0
        public void ReportByDateOfBirthMethod()
        {
            //create an instance of the class containing unfiltered results
            clsFlightCollection AllFlight = new clsFlightCollection();
            //create an instance of the filtered data
            clsFlightCollection FilteredFlight = new clsFlightCollection();

            //apply a blank string (should return all records)
            FilteredFlight.ReportByDateOfBirth("");
            //test to see that the two values are the same
            Assert.AreEqual(AllFlight.Count, FilteredFlight.Count);
        }