public void FilterbyPostcodeTestDataFound() { //create an instance of the filtered data clsCustomerCollection FilteredCustomers = new clsCustomerCollection("FBloggs"); //var to store outcome Boolean OK = true; //apply a primary key value FilteredCustomers.FilterbyPostCode("yyy yyy"); //check the correct number of records are found if (FilteredCustomers.Count == 2) { //check the first record is ID 2 if (FilteredCustomers.CustomerList[0].CustomerID != 8) { OK = false; } // check that the first record is ID if (FilteredCustomers.CustomerList[1].CustomerID != 17) { OK = false; } } else { OK = false; } //test to see there are records Assert.IsTrue(OK); }
public void FilterbyPostCodeNoneFound() { //create an instance of the filtered data clsCustomerCollection FilteredCustomers = new clsCustomerCollection(" "); //apply a blank string (should return all records) FilteredCustomers.FilterbyPostCode("xxx xxx"); //test to see the two values are the same Assert.AreEqual(0, FilteredCustomers.Count); }
public void FilterbyPostCodeMethodOK() { clsCustomer TestItem = new clsCustomer(); //create an instance of the class we want to create clsCustomerCollection AllCustomer = new clsCustomerCollection(); //create an instance of the filtered data clsCustomerCollection FilteredCustomers = new clsCustomerCollection(" "); //apply a blank string (should return all records) FilteredCustomers.FilterbyPostCode(""); //test to see the two values are the same Assert.AreEqual(AllCustomer.Count, FilteredCustomers.Count); }
void FilterPostCodade(string PostCode) { //create an instance of the booking collection clsCustomerCollection C = new clsCustomerCollection(" "); C.FilterbyPostCode(PostCode); //set the data source to the list of bookings in the collection lstCust.DataSource = C.CustomerList; //set the name of the primary key lstCust.DataValueField = "CustomerID"; //set the data field to display lstCust.DataTextField = "PostCode"; //bind the data to the list lstCust.DataBind(); }
Int32 FilterPostCode(string PostCode) { //create an instance of the booking collection clsCustomerCollection C = new clsCustomerCollection(" "); C.FilterbyPostCode(PostCode); //set the data source to the list of bookings in the collection lstCust.DataSource = C.CustomerList; //set the name of the primary key lstCust.ValueMember = "CustomerID"; //set the data field to display lstCust.DisplayMember = "PostCode"; //bind the data to the list return(C.Count); }