public void FilterByPostcodeTestDataFound() { //create an instance of the filtered data clsOrderCollection FilteredOrders = new clsOrderCollection(); //var to store outcome Boolean OK = true; //apply a post code that doesn't exist FilteredOrders.FilterByPostcode("NG2 1PN"); //checked that the correct number of records ar found if (FilteredOrders.OrderList.Count == 2) { //check that the first record is ID 1 if (FilteredOrders.OrderList[0].OrderID != 1) { OK = false; } //check that the first record is ID 2 if (FilteredOrders.OrderList[1].OrderID != 2) { OK = false; } } else { OK = false; } //test to see that there are no records Assert.IsTrue(OK); }
public void FilterByPostcodeNoneFound() { //create an instance of the filtered data clsOrderCollection FilteredOrders = new clsOrderCollection(); //apply a postcode that doesn't exist FilteredOrders.FilterByPostcode("ppp ppp"); //test to see that there are no records Assert.AreEqual(0, FilteredOrders.Count); }
public void FilterByPostcodeMethodOK() { //create an instance of the class we want to create clsOrderCollection AllOrders = new clsOrderCollection(); //create an instance of the filtered data clsOrderCollection FilteredOrders = new clsOrderCollection(); //apply a blank string (should return all records) FilteredOrders.FilterByPostcode(""); //test to see that the two values are the same Assert.AreEqual(AllOrders.Count, FilteredOrders.Count); }