public void FilterbyEmailTestDataFound() { //create an instance of the filtered data clsContactUsCollection FilteredContacts = new clsContactUsCollection(" "); //var to store outcome Boolean OK = true; //apply a primary key value FilteredContacts.FilterbyEmail("*****@*****.**"); //check the correct number of records are found if (FilteredContacts.Count == 12) { //check the first record is ID 2 if (FilteredContacts.ContactList[0].ContactId != 2000) { OK = false; } // check that the first record is ID if (FilteredContacts.ContactList[9].ContactId != 2013) { OK = false; } } else { OK = false; } //test to see there are records Assert.IsTrue(OK); }
public void FilterbyEmailNoneFound() { //create an instance of the filtered data clsContactUsCollection FilteredContacts = new clsContactUsCollection(" "); //apply a blank string (should return all records) FilteredContacts.FilterbyEmail("xxx xxx"); //test to see the two values are the same Assert.AreEqual(0, FilteredContacts.Count); }
public void FilterbyEmailOK() { clsContactUs TestItem = new clsContactUs(); //create an instance of the class we want to create clsContactUsCollection AContact = new clsContactUsCollection(); //create an instance of the filtered data clsContactUsCollection FilteredContacts = new clsContactUsCollection(""); //apply a blank string (should return all records) FilteredContacts.FilterbyEmail(""); //test to see the two values are the same Assert.AreEqual(AContact.Count, FilteredContacts.Count); }
void FilterEmail(string Email) { //create an instance of the booking collection clsContactUsCollection Contact = new clsContactUsCollection(); Contact.FilterbyEmail(Email); //set the data source to the list of bookings in the collection lstCont.DataSource = Contact.ContactList; //set the name of the primary key lstCont.DataValueField = "ContactId"; //set the data field to display lstCont.DataTextField = "Email"; //bind the data to the list lstCont.DataBind(); }