public void ReportByBookingNameTestDataFound() { //create an instance of the class containing unfiltered results clsPlaneCollection FilteredPlane = new clsPlaneCollection(); //var to store outcome Boolean OK = true; //apply a plane name that does not exist FilteredPlane.ReportByPlaneName("FlyDubaii"); //check that the correct number of records are found if (FilteredPlane.Count == 2) { //Check that the first record is ID 11 if (FilteredPlane.PlaneList[0].PlaneID != 11) { OK = false; } //Check that the first record is ID 14 if (FilteredPlane.PlaneList[1].PlaneID != 14) { OK = false; } } else { OK = false; } //test to see that there are no record Assert.IsTrue(OK); }
Int32 DisplayPlane(string PlaneNameFilter) { //var to store the PlaneName string PlaneName; //create an instance of customer collection class clsPlaneCollection Plane = new clsPlaneCollection(); Plane.ReportByPlaneName(PlaneNameFilter); //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 = Plane.Count; //clear the list box lstPlane.Items.Clear(); //while there are records while (Index < RecordCount) { //get the username PlaneName = Plane.PlaneList[Index].PlaneName; //create a new entry for th list box ListItem NewEntry = new ListItem(PlaneName + " ".ToString()); //add the plane to the list lstPlane.Items.Add(NewEntry); //move the index to the next record Index++; } //return to the count of records found return(RecordCount); }
public void ReportByPlaneNameNoneFoundMethod() { //create an instance of the class containing unfiltered results clsPlaneCollection FilteredPlane = new clsPlaneCollection(); //apply a plane name that doesnt exist FilteredPlane.ReportByPlaneName("XXXX"); //test to see that there are no records Assert.AreEqual(0, FilteredPlane.Count); }
public void ReportByPlaneNameMethod() { //create an instance of the class containing unfiltered results clsPlaneCollection AllPlane = new clsPlaneCollection(); //create an instance of the filtered data clsPlaneCollection FilteredPlane = new clsPlaneCollection(); //apply a blank string (should return all records) FilteredPlane.ReportByPlaneName(""); //test to see that the two values are the same Assert.AreEqual(AllPlane.Count, FilteredPlane.Count); }