public void SearchTest()
        {
            EmployeeSqlDAO  employeeSqlDAO = new EmployeeSqlDAO(connectionString);
            List <Employee> employeesList  = (List <Employee>)employeeSqlDAO.Search("Sid", "Goodman");

            Assert.AreEqual(1, employeesList.Count);
        }
Ejemplo n.º 2
0
        public void EmployeeSearch_Should_Return_Correct_Results(string firstName, string lastName, int expectedCount)
        {
            EmployeeSqlDAO   dao       = new EmployeeSqlDAO(ConnectionString);
            IList <Employee> employees = dao.Search(firstName, lastName);

            Assert.AreEqual(expectedCount, employees.Count);
        }
Ejemplo n.º 3
0
        public void Search_Test()
        {
            EmployeeSqlDAO   accessObj = new EmployeeSqlDAO(connectionString);
            IList <Employee> listofMatchedEmployess = accessObj.Search("JoEli", "Collinsall");

            Assert.AreEqual(1, listofMatchedEmployess.Count);
        }
Ejemplo n.º 4
0
        public void TestSearch()
        {
            EmployeeSqlDAO dao = new EmployeeSqlDAO(ConnectionString);

            IList <Employee> result = dao.Search("pe", "pe");

            Assert.AreEqual(NewEmployeeId, result[0].EmployeeId);
        }
Ejemplo n.º 5
0
        public void Search_Test()
        {
            EmployeeSqlDAO  getEmployee = new EmployeeSqlDAO(ConnectionString);
            List <Employee> searchTest  = (List <Employee>)getEmployee.Search("TheFun", "Employee");

            CollectionAssert.AllItemsAreNotNull(searchTest);
            Assert.AreEqual(1, searchTest.Count);
            Equals("TheFun", searchTest[0].FirstName);
        }
        public void SearchTest()
        {
            IList <Employee> employees;

            employees = dao.Search("Franklin", "Trumbauer");

            Assert.IsNotNull(employees);
            Assert.AreEqual(1, employees.Count);
        }
Ejemplo n.º 7
0
        public void SearchForEmployeeTest()
        {
            // Arrange
            EmployeeSqlDAO employee = new EmployeeSqlDAO(ConnectionString);

            // Act
            IList <Employee> employees = employee.Search("Sarah", "Watkins");

            // Assert
            Assert.AreEqual(1, employees.Count);
        }
Ejemplo n.º 8
0
        public void SearchTest()
        {
            EmployeeSqlDAO dao = new EmployeeSqlDAO(ConnectionString);

            IList <Employee> employees = dao.Search("First Name", "Last Name");

            Assert.IsNotNull(employees);
            Assert.IsTrue(employees.Count > 0);
            Employee testEmployee = employees.Where(e => e.EmployeeId == testEmployeeId).FirstOrDefault();

            Assert.IsNotNull(testEmployee);
            Assert.AreEqual("First Name", testEmployee.FirstName);
            Assert.AreEqual("Last Name", testEmployee.LastName);
        }
Ejemplo n.º 9
0
        public void TestSearch()
        {
            EmployeeSqlDAO   employee           = new EmployeeSqlDAO(connectionString);
            IList <Employee> employeeSearchList = employee.Search("JB", "Martin");

            bool result = false;

            foreach (Employee person in employeeSearchList)
            {
                if (person.FirstName == "JB")
                {
                    result = true;
                    break;
                }
            }

            Assert.IsTrue(result);
        }
Ejemplo n.º 10
0
        public void SearchEmployee_ShouldFindEmployeeName(string firstName, string lastName, bool isMatchExpected)
        {
            //Arrange
            EmployeeSqlDAO dao = new EmployeeSqlDAO(ConnectionString);

            const string testValFirstName = "John";//Set in sql test setup file
            const string testValLastName  = "Smith";

            //Act

            IList <Employee> employees = dao.Search(firstName, lastName);

            //list will be empty when search terms aren't in table and when table not empty then check name matches expected
            bool isMatch = employees.Count != 0 && (testValFirstName == employees[0].FirstName) && (testValLastName == employees[0].LastName);//employee[0] set in sql test file

            //Assert

            Assert.AreEqual(isMatchExpected, isMatch);
        }
Ejemplo n.º 11
0
        public void RemoveEmployeeFromProject_ShouldReturnTrueWhenEmployeeRemoved()
        {
            //Arrange
            const bool expectedResult = true;//when employee successfully removed, function should return true

            ProjectSqlDAO  projectDao = new ProjectSqlDAO(ConnectionString);
            EmployeeSqlDAO empDao     = new EmployeeSqlDAO(ConnectionString);


            IList <Project> projects = projectDao.GetAllProjects();

            IList <Employee> testEmployee = empDao.Search("John", "Smith");//Get the employee added in sql test file that does have a project assigned. name from sql test file


            //Act
            bool resultOfRemove = projectDao.RemoveEmployeeFromProject(projects[0].ProjectId, testEmployee[0].EmployeeId);//remove employee with project from the only project


            //Assert
            Assert.AreEqual(expectedResult, resultOfRemove, "RemoveEmployeeFromProject doesn't return true when employee removed");
        }
Ejemplo n.º 12
0
        public void RemoveEmployeeFromProject_ShouldReturnRightNumberOfEmployees()
        {
            //Arrange
            const int numberOfEmployeesWithoutProjects = 2;//set in sql test setup file plus the one employee removed here

            ProjectSqlDAO  projectDao = new ProjectSqlDAO(ConnectionString);
            EmployeeSqlDAO empDao     = new EmployeeSqlDAO(ConnectionString);


            IList <Project> projects = projectDao.GetAllProjects();

            IList <Employee> testEmployee = empDao.Search("John", "Smith");//Get the employee added in sql test file that does have a project assigned. name from sql test file


            //Act
            projectDao.RemoveEmployeeFromProject(projects[0].ProjectId, testEmployee[0].EmployeeId);//remove employee with project from the only project


            //Assert
            Assert.AreEqual(numberOfEmployeesWithoutProjects, empDao.GetEmployeesWithoutProjects().Count, "Remove Employee doesn't return correct number when employee removed");
        }