Ejemplo n.º 1
0
        public void GetAllEmployees_Should_Return_Correct_Count()
        {
            EmployeeSqlDAO   dao       = new EmployeeSqlDAO(ConnectionString);
            IList <Employee> employees = dao.GetAllEmployees();

            Assert.AreEqual(2, employees.Count);
        }
        public void GetAllEmployeesTest()
        {
            EmployeeSqlDAO  employeeSqlDAO = new EmployeeSqlDAO(connectionString);
            List <Employee> employeesList  = (List <Employee>)employeeSqlDAO.GetAllEmployees();

            Assert.AreEqual(12, employeesList.Count);
        }
Ejemplo n.º 3
0
        public void TestGetAllEmployees()
        {
            // Arrange
            EmployeeSqlDAO dao = new EmployeeSqlDAO(ConnectionString);

            //ACT
            IList <Employee> result = dao.GetAllEmployees();

            //ASERT
            Assert.AreEqual(GetRowCount("employee"), result.Count);
        }
Ejemplo n.º 4
0
        public void Get_Employee_Test()
        {
            //Arrange

            EmployeeSqlDAO getEmployee = new EmployeeSqlDAO(ConnectionString);

            List <Employee> employeeList = (List <Employee>)getEmployee.GetAllEmployees();

            //Assert
            Assert.IsNotNull(employeeList);
            Assert.AreEqual(numberOfEmployees + 1, employeeList.Count);
        }
Ejemplo n.º 5
0
        public void GetAllEmployees_ShouldReturnRightNumberOfEmployees()
        {
            //Arrange
            const int numberOfEmployeesAddedForTests = 2;//set in sql test setup file

            EmployeeSqlDAO dao = new EmployeeSqlDAO(ConnectionString);

            //Act
            IList <Employee> employees = dao.GetAllEmployees();

            //Assert
            Assert.AreEqual(numberOfEmployeesAddedForTests, employees.Count, "GetAllEmployees doesn't return correct number for one employee");
        }
Ejemplo n.º 6
0
        public void GetAllEmployees_ShouldReturnEmployees()
        {
            //Arrange
            EmployeeSqlDAO employee = new EmployeeSqlDAO(ConnectionString);


            //Act
            int result = employee.GetAllEmployees().Count;


            //Assert
            Assert.AreEqual(1, result);
        }
Ejemplo n.º 7
0
        public void GetAllEmployeesTest()
        {
            // Arrange

            EmployeeSqlDAO employee = new EmployeeSqlDAO(ConnectionString);

            // Act

            IList <Employee> employees = employee.GetAllEmployees();

            // Assert
            Assert.AreEqual(2, employees.Count);
        }
        public void GetAllEmployeesTest()
        {
            IList <Employee> employees;
            int expectedResult;

            using (SqlConnection conn = new SqlConnection(connectionString))
            {
                conn.Open();
                SqlCommand cmd = new SqlCommand("SELECT COUNT(*) from employee", conn);
                expectedResult = Convert.ToInt32(cmd.ExecuteScalar());
            }
            employees = dao.GetAllEmployees();
            Assert.AreEqual(expectedResult, employees.Count);
        }
Ejemplo n.º 9
0
        public void GetAllEmployeesTest()
        {
            EmployeeSqlDAO dao = new EmployeeSqlDAO(ConnectionString);

            IList <Employee> employees = dao.GetAllEmployees();

            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);
            Assert.AreEqual(testDepartmentId, testEmployee.DepartmentId);
        }
Ejemplo n.º 10
0
        public void GetAllEmployees_Test()
        {
            EmployeeSqlDAO   accessObj = new EmployeeSqlDAO(connectionString);
            IList <Employee> items     = accessObj.GetAllEmployees();

            bool found = false;

            foreach (Employee loopItem in items)
            {
                if (loopItem.LastName == "Collinsall")
                {
                    found = true;
                    break;
                }
            }
            Assert.IsTrue(found);
        }
Ejemplo n.º 11
0
        public void TestGetAllEmployees()
        {
            EmployeeSqlDAO   employee     = new EmployeeSqlDAO(connectionString);
            IList <Employee> employeeList = employee.GetAllEmployees();

            bool found = false;

            foreach (Employee person in employeeList)
            {
                if (person.JobTitle == "TRAITOR")
                {
                    found = true;
                    break;
                }
            }

            Assert.IsTrue(found);
        }