public void ReportByEmailTestDataFound() { StaffingCollection fStaffingCollection = new StaffingCollection(); //var to store the outcomes Boolean OK = true; fStaffingCollection.ReportByEmail("yyy yyy"); if (fStaffingCollection.Count == 2) { //check that the first record ID is 31 if (fStaffingCollection.StaffList[0].staffID != 54) { OK = false; } //check that the second record ID is 34 if (fStaffingCollection.StaffList[1].staffID != 55) { OK = false; } } else { OK = false; } //test to see that there are nbo records Assert.IsTrue(OK); }
public void ReportByEmailNoneFound() { StaffingCollection allStaff = new StaffingCollection(); StaffingCollection filteredStaff = new StaffingCollection(); //Apply an email that doesn't exist filteredStaff.ReportByEmail("xxx xxx"); Assert.AreEqual(0, filteredStaff.Count); }
public void ReportByEmailMethodOK() { StaffingCollection allStaff = new StaffingCollection(); StaffingCollection filteredStaff = new StaffingCollection(); //Apply an email that doesn't exist filteredStaff.ReportByEmail(""); Assert.AreEqual(allStaff.Count, filteredStaff.Count); }
protected void btnApply_Click(object sender, EventArgs e) { StaffingCollection Staff = new StaffingCollection(); Staff.ReportByEmail(txtEmailFilter.Text); lstStaffingList.DataSource = Staff.StaffList; //Set the name of the primary key lstStaffingList.DataValueField = "StaffID"; //set the name of the field to display lstStaffingList.DataValueField = "StaffEmail"; //bind the data to the list lstStaffingList.DataBind(); }