public void ReportByBookingNoTestDataFound() { //create an instance of the filtered data clsOrderlineCollection FilteredOrderline = new clsOrderlineCollection(); //var to store the outcome Boolean OK = true; //apply a booking no that doesnt exist FilteredOrderline.ReportByBookingNo("Tes12"); //check that the correct number of records are found if (FilteredOrderline.Count == 2) { //check that the first record is ID 34 if (FilteredOrderline.OrderlineList[0].OrderlineID != 34) { OK = false; } //check that the first record is ID 35 if (FilteredOrderline.OrderlineList[1].OrderlineID != 35) { OK = false; } } else { OK = false; } //test to see that there are no records Assert.IsTrue(OK); }
Int32 DisplayOrderline(string BookingNoFilter) { //var to store the BookingNo string BookingNo; //create an instance of the Orderline collection class clsOrderlineCollection Orderline = new clsOrderlineCollection(); Orderline.ReportByBookingNo(BookingNoFilter); //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 = Orderline.Count; //clear the list box lstOrderline.Items.Clear(); //while there are records while (Index < RecordCount) { //get the BookingNo BookingNo = Orderline.OrderlineList[Index].BookingNo; //create a new entry for the list box ListItem NewEntry = new ListItem(BookingNo + " ".ToString()); //add the staff to the list lstOrderline.Items.Add(NewEntry); //move the index to the next record Index++; } //return to the count of records found return(RecordCount); }
public void ReportByBookingNoNoneMethod() { //create an instance of the filtered data clsOrderlineCollection FilteredOrderline = new clsOrderlineCollection(); //apply a Booking Number that does not exist FilteredOrderline.ReportByBookingNo("YYYYY"); //test to see that there are no records Assert.AreEqual(0, FilteredOrderline.Count); }
public void ReportByBookingNoMethod() { //create an instance of the class containing unfiltered results clsOrderlineCollection AllOrderline = new clsOrderlineCollection(); //create an instance of the filtered data clsOrderlineCollection FilteredOrderline = new clsOrderlineCollection(); //apply a blank string (should return all records) FilteredOrderline.ReportByBookingNo(""); //test to see that the two values are the same Assert.AreEqual(AllOrderline.Count, FilteredOrderline.Count); }