public void ReportByEmployeeNameTestDataFound() { clsReportsCollection FilteredEmployeeNames = new clsReportsCollection(); //var to store the outcome Boolean OK = true; //apply a employee name that does not exist FilteredEmployeeNames.ReportByEmployeeName("John"); //check that the correct number of record is found if (FilteredEmployeeNames.Count == 2) { //check that the first record ID is 2 if (FilteredEmployeeNames.ReportList[0].EmployeeId != 2) { OK = false; } //check that the first record Id is 37 if (FilteredEmployeeNames.ReportList[1].EmployeeId != 37) { OK = false; } } else { OK = false; } //test to see that there are no records Assert.IsTrue(OK); }
public void ReportByEmployeeNameNoneFound() { clsReportsCollection FilteredEmployeeNames = new clsReportsCollection(); //apply a employee name that does not exist FilteredEmployeeNames.ReportByEmployeeName("xxxxxx"); //test to see that there are no records Assert.AreEqual(0, FilteredEmployeeNames.Count); }
public void ReportByEmployeeNameMethodOK() { clsReportsCollection AllReports = new clsReportsCollection(); //create an instance of the filtered data clsReportsCollection FilteredEmployeeNames = new clsReportsCollection(); //apply a blank string (should return all records) FilteredEmployeeNames.ReportByEmployeeName(""); //test to see that the two values are the same Assert.AreEqual(AllReports.Count, FilteredEmployeeNames.Count); }
protected void btnApply_Click(object sender, EventArgs e) { //create an instance of the class collection clsReportsCollection Reports = new clsReportsCollection(); Reports.ReportByEmployeeName(txtEmployeeName.Text); lstReportsList.DataSource = Reports.ReportList; //set the name of the primary key lstReportsList.DataValueField = "EmployeeId"; //set the name of the field to display lstReportsList.DataTextField = "EmployeeName"; //bind the data to the list lstReportsList.DataBind(); }
protected void btnClear_Click(object sender, EventArgs e) { clsReportsCollection Reports = new clsReportsCollection(); Reports.ReportByEmployeeName(""); //clear any existing filter to tidy up the interface txtEmployeeName.Text = ""; lstReportsList.DataSource = Reports.ReportList; //set the name of the primary key lstReportsList.DataValueField = "EmployeeId"; //set the name of the field to display lstReportsList.DataTextField = "EmployeeName"; //bind the data to the list lstReportsList.DataBind(); }