Exemplo n.º 1
0
        public void ReportByEmployeeNameTestDataFound()
        {
            //create an instance of the filtered data
            clsEmployeeCollection FilteredEmployees = new clsEmployeeCollection();
            //var to store outcome
            Boolean OK = true;

            //apply a Name that doesn't exist
            FilteredEmployees.ReportByEmployeeName("Thomas Wilson");
            //check that the correct number of records are found
            if (FilteredEmployees.Count == 3)
            {
                //check that the first record is ID 1
                if (FilteredEmployees.EmployeeList[0].Emp_ID != 1)
                {
                    OK = false;
                }
                //check that the first record is ID 67
                if (FilteredEmployees.EmployeeList[1].Emp_ID != 67)
                {
                    OK = false;
                }
                //check that the first record is ID 106
                if (FilteredEmployees.EmployeeList[2].Emp_ID != 106)
                {
                    OK = false;
                }
            }
            else
            {
                OK = false;
            }
            //test to see that there are no records
            Assert.IsTrue(OK);
        }
Exemplo n.º 2
0
    //event handler for the apply button
    protected void btnApply_Click(object sender, EventArgs e)
    {
        clsEmployeeCollection employees = new clsEmployeeCollection();

        employees.ReportByEmployeeName(txtName.Text);
        lstempoyees.DataSource     = employees.EmployeeList;
        lstempoyees.DataValueField = "emp_ID";
        lstempoyees.DataTextField  = "emp_Name";
        lstempoyees.DataBind();
    }
Exemplo n.º 3
0
        public void ReportByEmployeeNameNoneFound()
        {
            //create an instance of the filtered data
            clsEmployeeCollection FilteredEmployees = new clsEmployeeCollection();
            //apply a post code that doesn't exist
            string test = "ffqobe";

            FilteredEmployees.ReportByEmployeeName(test);
            //test to see that there are no records
            Assert.AreEqual(0, FilteredEmployees.Count);
        }
Exemplo n.º 4
0
        public void ReportByEmployeeNameMethodOK()
        {
            //create an instance of the class containing unfiltered results
            clsEmployeeCollection AllEmpoyees = new clsEmployeeCollection();
            //create an instance of the filtered data
            clsEmployeeCollection FilteredEmployees = new clsEmployeeCollection();

            //apply a blank string (should return all records);
            FilteredEmployees.ReportByEmployeeName("");
            //test to see that the two values are the same
            Assert.AreEqual(FilteredEmployees.Count, AllEmpoyees.Count);
        }