public void FilterbyuseremailTestDataFound() { //create an instance of the filtered data clsBookingCollection FilteredBookings = new clsBookingCollection(" "); //var to store outcome Boolean OK = true; //apply a primary key value FilteredBookings.Filterbyemail("*****@*****.**"); //check the correct number of records are found if (FilteredBookings.Count == 20) { //check the first record is ID 2 if (FilteredBookings.BookingsList[0].BookRef != 2000) { OK = true; } // check that the first record is ID if (FilteredBookings.BookingsList[1].BookRef != 2002) { OK = false; } } else { OK = false; } //test to see there are records Assert.IsTrue(OK); }
public void FilterbyuseremailNoneFound() { //create an instance of the filtered data clsBookingCollection AllBookings = new clsBookingCollection(" "); //apply a blank string (should return all records) AllBookings.Filterbyemail("xxx xxx"); //test to see the two values are the same Assert.AreEqual(0, AllBookings.Count); }
public void FilterbyuseremailOK() { clsBooking TestItem = new clsBooking(); //create an instance of the class we want to create clsBookingCollection AllBookings = new clsBookingCollection(); //create an instance of the filtered data clsBookingCollection FilteredBookings = new clsBookingCollection(" "); //apply a blank string (should return all records) FilteredBookings.Filterbyemail(""); //test to see the two values are the same Assert.AreEqual(AllBookings.Count, FilteredBookings.Count); }
void Filteremail(string useremail) { //create an instance of the booking collection clsBookingCollection Booking = new clsBookingCollection(); Booking.Filterbyemail(useremail); //set the data source to the list of bookings in the collection lstBooking.DataSource = Booking.BookingsList; //set the name of the primary key lstBooking.DataValueField = "bookRef"; //set the data field to display lstBooking.DataTextField = "useremail"; //bind the data to the list lstBooking.DataBind(); }