Beispiel #1
0
        public void GreenTextChangedMethod()
        {
            //Arrange
            Form1 form1 = new Form1();

            BusinessRules.employeeList.Clear();
            ListView ListView1 = new ListView();
            ListView ListView2 = new ListView();
            Hourly   temp      = new Hourly("AA5", "Cheryl", "Kirk", "Cheryl Kirk", 3.98, 4);

            BusinessRules.AddEmployee(form1, temp);
            Contract hey = new Contract("L-1337", "John", "Chief", "John Chief", 5);

            BusinessRules.AddEmployee(form1, hey);
            Salary sup = new Salary("HAMBURGER", "Phil", "Hartman", "Phil Hartman", 7.896);

            BusinessRules.AddEmployee(form1, sup);
            Sales bro = new Sales("EMPLOYEE_ID", "David", "Lynch", "David Lynch", 4, 5.86, 387);

            BusinessRules.AddEmployee(form1, bro);
            form1.comboBox2.SelectedItem = "Full Name";
            //Act
            form1.textBox7.Text += "D";
            ListView1            = form1.searchEmployees();
            ListView2.Items.Add(bro.fullName);
            //Assert
            Assert.AreEqual(ListView1.Items[0].ToString(), ListView2.Items[0].ToString());
        }
Beispiel #2
0
        public void DeleteTestMethod()
        {
            BusinessRules.isActive = false;
            Form1 form1 = new Form1();

            BusinessRules.employeeList.Clear();
            BusinessRules.isActive = false;
            ListView ListView1 = new ListView();
            ListView ListView2 = new ListView();
            Hourly   temp      = new Hourly("AA5", "Cheryl", "Kirk", "Cheryl Kirk", 3.98, 4);

            BusinessRules.AddEmployee(form1, temp);
            Contract hey = new Contract("L-1337", "John", "Chief", "John Chief", 5);

            BusinessRules.AddEmployee(form1, hey);
            Salary sup = new Salary("HAMBURGER", "Phil", "Hartman", "Phil Hartman", 7.896);

            BusinessRules.AddEmployee(form1, sup);
            Sales bro = new Sales("EMPLOYEE_ID", "David", "Lynch", "David Lynch", 4, 5.86, 387);

            BusinessRules.AddEmployee(form1, bro);
            BusinessRules.AddEmployeeDel(form1, bro);
            form1.populateItem(bro.empId);

            ListView1 = form1.listView1;
            ListView2.Items.Add(bro.fullName);

            Assert.AreEqual(ListView1.Items[0].ToString(), ListView2.Items[0].ToString());
        }
Beispiel #3
0
        public void GreenSearchFullTestMethod()
        {
            //Arrange
            string empId     = "301";
            string firstName = "";
            string lastName  = "";
            string fullName  = "Richard Wilson";
            double monthly   = 1;
            Salary emp       = new Salary(empId, firstName, lastName, fullName, monthly);
            Form1  form1     = new Form1();

            BusinessRules.employeeList.Clear();
            //Act
            BusinessRules.AddEmployee(form1, emp);
            List <Employee> temp = BusinessRules.SearchEmployeeFull(fullName);

            //Assert
            Assert.AreEqual(temp[0].fullName, emp.fullName);
        }
Beispiel #4
0
        public void RedSearchFirstTestMethod()
        {
            //Arrange
            string empId     = "301";
            string firstName = "George";
            string lastName  = "";
            string fullName  = "";
            double monthly   = 1;
            Salary emp       = new Salary(empId, firstName, lastName, fullName, monthly);
            Form1  form1     = new Form1();

            BusinessRules.employeeList.Clear();
            //Act
            BusinessRules.AddEmployee(form1, emp);
            List <Employee> temp = BusinessRules.SearchEmployeeFirst(firstName);

            //Assert
            Assert.AreEqual(temp[0].firstName, "Robert");
        }
Beispiel #5
0
        public void GreenBusinessTestMethod()
        {
            //Arrange
            Form1  form1     = new Form1();
            string empId     = "101";
            string tempId    = empId;
            string firstName = "";
            string lastName  = "";
            string fullName  = "";
            double monthly   = 1;
            Salary emp       = new Salary(empId, firstName, lastName, fullName, monthly);
            Salary temp      = new Salary(tempId, firstName, lastName, fullName, monthly);

            BusinessRules.employeeList.Clear();
            //Act
            BusinessRules.AddEmployee(form1, emp);
            //Assert
            Employee empRep = BusinessRules.employeeList[empId];

            Assert.AreEqual(empRep.empId, temp.empId);
        }