public void ReportByPostCodeFound() { //create an instance of the filtered data clsCustomerCollection FilteredCustomers = new clsCustomerCollection(); //var to store the outcome Boolean OK = true; //apply a poscode that doesnt exsit FilteredCustomers.ReportByPostCode("yyyy yyy"); //check that the correct number of records are found if (FilteredCustomers.Count == 2) { //check that the first record is ID 36 if (FilteredCustomers.CustomerList[0].UserNumber != 36) { OK = false; } //check if the first record is ID 37 if (FilteredCustomers.CustomerList[1].UserNumber != 37) { OK = false; } } else { OK = false; } //test to see that there are no records Assert.IsTrue(OK); }
public void ReportByMethodTestDataFound() { //create an instance of the filtered data clsCustomerCollection FilteredCustomers = new clsCustomerCollection(); //var to store outcome Boolean OK = false; //apply a post code that doesn't exist FilteredCustomers.ReportByPostCode("yyy yyy"); //check that the correct number of records are found if (FilteredCustomers.Count == 2) { //check that the first record is ID 12 if (FilteredCustomers.CustomerList[0].CustomerID != 12) { OK = false; } //check that the first record is ID 13 if (FilteredCustomers.CustomerList[1].CustomerID != 13) { OK = false; } else { OK = false; } //test to see that there are no records Assert.IsFalse(OK); } }
public void ReportByPostCodeNoneFound() { //create an instance of the filtered data clsCustomerCollection FilteredCustomers = new clsCustomerCollection(); //apply a post code that doesn't exist FilteredCustomers.ReportByPostCode("xxx xxx"); //test to see that there are no records Assert.AreEqual(0, FilteredCustomers.Count); }
public void ReportByPostCodeNoneFound() { //instance of the filterd data clsCustomerCollection FilteredCustomers = new clsCustomerCollection(); //apply apost code that dosent exist FilteredCustomers.ReportByPostCode("xxx xxx"); //test to see that the two values are the same Assert.AreEqual(0, FilteredCustomers.Count); }
public void ReportByPostCodeNoneFound() { //create an instance of the filtered data clsCustomerCollection FilteredCustomers = new clsCustomerCollection(); //apply a blank string (should return all records) FilteredCustomers.ReportByPostCode("XXXX XXX"); //test to see that the two values are the same Assert.AreEqual(0, FilteredCustomers.Count); }
public void ReportByPostCodeMethodOK() { //create an instance of the class contianing unfiltered results clsCustomerCollection AllCustomers = new clsCustomerCollection(); //create an instance of the filtered data clsCustomerCollection FilteredCustomers = new clsCustomerCollection(); //apply a blank tring (should return all records) FilteredCustomers.ReportByPostCode(""); //test to see that the two values are the same Assert.AreEqual(AllCustomers.Count, FilteredCustomers.Count); }
Int32 DisplayCustomersByPostCode(string PostCodeFilter) { ///this function accepts one parameter - the post code to filter the list on ///it populates the list box with data //new instance of the clsCustomerCollection clsCustomerCollection AllCustomers = new clsCustomerCollection(); //var to store the count of the record Int32 Count; //var to store email string Email; //var to store the index Int32 Index = 0; //clear the list of any existing items //lstCustomers.Items.Clear(); //call the filter by post code method AllCustomers.ReportByPostCode(PostCodeFilter); //get the count of records found Count = AllCustomers.Count; //loop through each record found using the index to point to each record in data table while (Index < Count) { Email = Convert.ToString(AllCustomers.CustomersList[Index].Email); //set up a new object of class list item lstCustomers.DataSource = AllCustomers.CustomersList; //set the text to be displayed lstCustomers.DisplayMember = "Email"; //increment the index Index++; } //return the number of records found return(Count); }