public void ReportByCountryDepartureTestDataFound() { //create an instance of the class containing unfiltered results clsLocationCollection FilteredLocation = new clsLocationCollection(); //var to store outcome Boolean OK = true; //apply a name that does not exist FilteredLocation.ReportByCountryDeparture("India"); //check that the correct number of records are found if (FilteredLocation.Count == 2) { //Check that the first record is ID 23 if (FilteredLocation.LocationList[0].LocationID != 1) { OK = false; } //Check that the first record is ID 24 if (FilteredLocation.LocationList[1].LocationID != 9) { OK = false; } } else { OK = false; } //test to see that there are no record Assert.IsTrue(OK); }
public void ReportByCountryDepartureNoneFound() { //create an instance of the class containing unfiltered results clsLocationCollection FilteredLocation = new clsLocationCollection(); //apply a country of departure that dont exist FilteredLocation.ReportByCountryDeparture("XXXXXXX"); //test to see that there are no records Assert.AreEqual(0, FilteredLocation.Count); }
public void ReportByCountryDepartureMethod() { //create an instance of the class containing unfiltered results clsLocationCollection AllLocation = new clsLocationCollection(); //create an instance of the filtered data clsLocationCollection FilteredLocation = new clsLocationCollection(); //apply a blank string (should return all records) FilteredLocation.ReportByCountryDeparture(""); //test to see that the two values are the same Assert.AreEqual(AllLocation.Count, FilteredLocation.Count); }
Int32 DisplayLocation(string CountryDepartureFilter) { //var to store the CountryDeparture string CountryDeparture; //var to store the AirportDestination string AirportDestination; //create an instance of location collection class clsLocationCollection Location = new clsLocationCollection(); Location.ReportByCountryDeparture(CountryDepartureFilter); //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 = Location.Count; //clear the list box lstLocation.Items.Clear(); //while there are records while (Index < RecordCount) { //get the CountryDeparture CountryDeparture = Location.LocationList[Index].CountryDeparture; //get the AirportDestination AirportDestination = Location.LocationList[Index].AirportDestination; //create a new entry for th list box ListItem NewEntry = new ListItem(CountryDeparture + " " + AirportDestination.ToString()); //add the customer to the list lstLocation.Items.Add(NewEntry); //move the index to the next record Index++; } //return to the count of records found return(RecordCount); }