public void AddEmployeeToList_InvalidEmployee_EmployeeNotAddedToList() { // Instantiate an Employee object and a private object DateTime dateOfBirth = new DateTime(1987, 11, 29); Employee employee = new Employee(); employee.SetFirstName("Janet"); employee.SetLastName("Moore"); employee.SetSocialInsuranceNumber(872046458); var privateObject = new PrivateObject(employeeRepo); // Execute the method that is being tested privateObject.Invoke("AddEmployeeToList", employee); // Check if the expected result and actual result are the same List<Employee> employeeList = (List<Employee>)privateObject.GetField("listOfEmployees"); Assert.AreEqual(0, employeeList.Count); }
public void SetSocialInsuranceNumberTestInvalidTooLarge() { Employee employee = new Employee(); bool retVal = employee.SetSocialInsuranceNumber(1112345678); Assert.IsFalse(retVal); Assert.AreEqual(employee.GetSocialInsuranceNumber(), 0); }
public void SetSocialInsuranceNumberTestValid() { Employee employee = new Employee(); bool retVal = employee.SetSocialInsuranceNumber(123456789); Assert.IsTrue(retVal); Assert.AreEqual(employee.GetSocialInsuranceNumber(), 123456789); }