Ejemplo n.º 1
0
        public void GetAllEmployeesTest()
        {
            EmployeeSqlDAL  testEmployee = new EmployeeSqlDAL(connectionString);
            List <Employee> testList     = testEmployee.GetAllEmployees();

            Assert.AreEqual(numOfEmployee, testList.Count);
        }
Ejemplo n.º 2
0
        public void Initialize()
        {
            _departmentItem = new DepartmentSqlDAL(_connectionString);

            _department = new Department();

            _department.Name = "Test Department";

            _department.Id = _departmentItem.CreateDepartment(_department);

            // Initialize a new transaction scope. This automatically begins the transaction.
            tran = new TransactionScope();

            _employeeItem = new EmployeeSqlDAL(_connectionString);

            _employee = new Employee();

            _employee.DepartmentId = _department.Id;
            _employee.FirstName    = "John";
            _employee.LastName     = "Smith";
            _employee.Gender       = "M";
            _employee.JobTitle     = "Developer";
            _employee.BirthDate    = new DateTime(1990, 01, 01);
            _employee.HireDate     = new DateTime(2000, 02, 03);

            _employee.EmployeeId = _employeeItem.CreateEmployee(_employee);
        }
Ejemplo n.º 3
0
        public void GetEmployeesWithoutProjects_Test()
        {
            EmployeeSqlDAL  getEmployeeTest = new EmployeeSqlDAL(connectionString);
            List <Employee> noProjectList   = getEmployeeTest.GetEmployeesWithoutProjects();

            Assert.AreEqual(noProjectsCount, noProjectList.Count);
        }
Ejemplo n.º 4
0
        public void GetAllEmployeesTest()
        {
            EmployeeSqlDAL  employee  = new EmployeeSqlDAL(connectionString);
            List <Employee> employees = employee.GetAllEmployees();

            Assert.AreEqual(12, employees.Count);
        }
Ejemplo n.º 5
0
        public void EmployeeSearchTest()
        {
            EmployeeSqlDAL   employee = new EmployeeSqlDAL(connectionString);
            IList <Employee> restul   = employee.Search("John", "Fulton");

            Assert.IsNotNull(restul);
        }
Ejemplo n.º 6
0
        public void SearchTest()
        {
            EmployeeSqlDAL  employee  = new EmployeeSqlDAL(connectionString);
            List <Employee> employees = employee.Search("Flo", "Henderson");

            Assert.AreEqual(1, employees.Count);
        }
Ejemplo n.º 7
0
        public void GetEmployeesWithoutProjectsTest()
        {
            EmployeeSqlDAL  employee  = new EmployeeSqlDAL(connectionString);
            List <Employee> employees = employee.GetEmployeesWithoutProjects();

            Assert.AreEqual(1, employees.Count);
        }
        public void EmployeeTests()
        {
            // Open a SqlConnection object using the active transaction
            using (SqlConnection conn = new SqlConnection(connectionString))
            {
                conn.Open();

                EmployeeSqlDAL   testDAL  = new EmployeeSqlDAL(connectionString);
                IList <Employee> testList = new List <Employee>();
                testList = testDAL.GetAllEmployees();
                int savecount = testList.Count;
                Assert.AreNotEqual(0, testList.Count, "There should be Initial Data");

                Employee testEmployee = new Employee();
                testEmployee.DepartmentId = 1;
                testEmployee.FirstName    = "Roger";
                testEmployee.LastName     = "Rabbit";
                testEmployee.JobTitle     = "Cartoon Actor";
                testEmployee.BirthDate    = Convert.ToDateTime("01/01/1981");
                testEmployee.Gender       = "M";
                testEmployee.HireDate     = Convert.ToDateTime("06/22/1988");

                SqlCommand command = new SqlCommand("Insert into employee (department_id,first_name,last_name,job_title,birth_date,gender,hire_date)" +
                                                    $" Values ('{testEmployee.DepartmentId}','{testEmployee.FirstName}','{testEmployee.LastName}','{testEmployee.JobTitle}','{testEmployee.BirthDate}','{testEmployee.Gender}','{testEmployee.HireDate}')", conn);
                command.ExecuteNonQuery();

                testList = testDAL.GetAllEmployees();
                Assert.AreEqual(savecount + 1, testList.Count, "List should have 1 more element");
                testList = testDAL.Search("Roger", "Rabbit");
                Assert.AreEqual(1, testList.Count, "Search should return 1");
            }
        }
Ejemplo n.º 9
0
        public void EmployeeWithoutProjectTest()
        {
            EmployeeSqlDAL   employee = new EmployeeSqlDAL(connectionString);
            IList <Employee> list     = employee.GetEmployeesWithoutProjects();

            Assert.IsTrue(list.Count > 0);
        }
        public void GetEmployeesWithoutProjectsTest()
        {
            EmployeeSqlDAL  newEmployee   = new EmployeeSqlDAL(connectionString);
            List <Employee> employeesList = newEmployee.GetEmployeesWithoutProjects();

            Assert.IsNotNull(employeesList);
        }
        public void ShowEmployees()
        {
            EmployeeSqlDAL  employeeSqlDal = new EmployeeSqlDAL(connectionString);
            List <Employee> employees      = employeeSqlDal.GetAllEmployees();

            Assert.IsNotNull(employees);
            Assert.AreEqual(numOfEmployee, employees.Count - 1);
        }
Ejemplo n.º 12
0
        public void GetAllEmployeeWithoutProjectsTests()
        {
            EmployeeSqlDAL  empDal = new EmployeeSqlDAL(connectionString);
            List <Employee> emp    = empDal.GetAllEmployees();

            Assert.AreEqual("firstname", emp[emp.Count - 1].FirstName);
            Assert.AreEqual("lastname", emp[emp.Count - 1].LastName);
        }
Ejemplo n.º 13
0
        public void SearchTest()
        {
            EmployeeSqlDAL  empDal = new EmployeeSqlDAL(connectionString);
            List <Employee> emp    = empDal.Search("Chris", "Christie");

            Assert.AreEqual(1, emp.Count);
            Assert.AreEqual("Chris", emp[0].FirstName);
        }
Ejemplo n.º 14
0
        public void GetAllEmployeeTests()
        {
            EmployeeSqlDAL  empDal = new EmployeeSqlDAL(connectionString);
            List <Employee> emp    = empDal.GetAllEmployees();

            Assert.AreEqual(13, emp.Count);
            Assert.AreEqual("firstname", emp[12].FirstName);
        }
Ejemplo n.º 15
0
        public void GetEmployeesWithoutProjects()
        {
            EmployeeSqlDAL eSQL = new EmployeeSqlDAL(connectionString);

            List <Employee> e = eSQL.GetEmployeesWithoutProjects();

            Assert.IsNotNull(e);
        }
Ejemplo n.º 16
0
        public void SearchTest()
        {
            EmployeeSqlDAL eSQL = new EmployeeSqlDAL(connectionString);

            List <Employee> e = eSQL.Search("Matthew", "Duford");

            Assert.IsNotNull(e);
        }
Ejemplo n.º 17
0
        public void GetAllEmployeesTest()
        {
            EmployeeSqlDAL eSQL = new EmployeeSqlDAL(connectionString);

            List <Employee> e = eSQL.GetAllEmployees();

            Assert.IsNotNull(e);
        }
        public void SearchTest()
        {
            EmployeeSqlDAL  newEmployee   = new EmployeeSqlDAL(connectionString);
            List <Employee> employeesList = newEmployee.Search("Mike", "Beers");

            Assert.AreEqual(employeesList[0].FirstName, "Mike");
            Assert.AreEqual(employeesList[0].LastName, "Beers");
        }
Ejemplo n.º 19
0
        public void GetWithoutProjectsTest()
        {
            EmployeeSqlDAL  testEmployee = new EmployeeSqlDAL(connectionString);
            List <Employee> withoutList  = testEmployee.GetEmployeesWithoutProjects();

            Assert.AreEqual(2, withoutList.Count);
            Assert.AreEqual("Coty", withoutList[0].LastName);
        }
Ejemplo n.º 20
0
        public void GetAllEmployeesTest()
        {
            EmployeeSqlDAL   employee = new EmployeeSqlDAL(connectionString);
            IList <Employee> names    = employee.GetAllEmployees();

            Assert.IsNotNull(names);
            Assert.AreEqual(employeeCount + 1, names.Count);
        }
Ejemplo n.º 21
0
        public void GetAllEmployees_Test()
        {
            EmployeeSqlDAL  getEmployeeTest = new EmployeeSqlDAL(connectionString);
            List <Employee> employeeList    = getEmployeeTest.GetAllEmployees();

            Assert.IsNotNull(employeeList);
            Assert.AreEqual(employeeCount + 1, employeeList.Count);
        }
        public void GetAllEmployeesTest()
        {
            EmployeeSqlDAL employeeSqldal = new EmployeeSqlDAL(connectionString);

            List <Employee> employees = employeeSqldal.GetAllEmployees();

            Assert.AreEqual(numberOfEmployees, employees.Count);
        }
Ejemplo n.º 23
0
        public void SearchEmployeesTest()
        {
            EmployeeSqlDAL  testEmployee = new EmployeeSqlDAL(connectionString);
            List <Employee> testList     = testEmployee.Search("Sid", "Goodman");

            Assert.AreEqual("Sid", testList[0].FirstName);
            Assert.AreEqual("Goodman", testList[0].LastName);
            Assert.AreEqual(1, testList.Count);
        }
Ejemplo n.º 24
0
        public void Search_Test()
        {
            EmployeeSqlDAL  getEmployeeTest = new EmployeeSqlDAL(connectionString);
            List <Employee> empSearchTest   = getEmployeeTest.Search("Test", "Employee");

            CollectionAssert.AllItemsAreNotNull(empSearchTest);
            Assert.AreEqual(1, empSearchTest.Count);
            Equals("Test", empSearchTest[0].FirstName);
        }
Ejemplo n.º 25
0
        public void SearchEmployeesTest()
        {
            //Arrange
            EmployeeSqlDAL employeeDAL = new EmployeeSqlDAL(connectionString);


            //Assert
            Assert.AreEqual(2, newEmployeeID);
        }
        public void GetAllEmployeesTest()
        {
            EmployeeSqlDAL  newEmployee   = new EmployeeSqlDAL(connectionString);
            List <Employee> employeesList = newEmployee.GetAllEmployees();

            employees++;

            Assert.IsNotNull(employeesList);
            Assert.AreEqual(employees, employeesList.Count);
        }
        public void SearchEmployee()
        {
            EmployeeSqlDAL  employeeSqlDal = new EmployeeSqlDAL(connectionString);
            List <Employee> employees      = employeeSqlDal.GetAllEmployees();

            employees = employeeSqlDal.Search("Joe", "Testman");

            Assert.AreEqual(employeeId, employees[0].EmployeeId);
            Assert.AreEqual("Joe", employees[0].FirstName);
        }
Ejemplo n.º 28
0
        public void EmployeeListTests()
        {
            EmployeeSqlDAL employeeDal = new EmployeeSqlDAL(connectionString);

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

            Assert.AreEqual(12, getEmployee.Count);
            Assert.IsNotNull(getEmployee);
            Assert.IsTrue(getEmployee.Count > 0);
        }
Ejemplo n.º 29
0
        public void EmployeesWithoutProjectsTest()
        {
            //Arrange
            EmployeeSqlDAL employeeDAL = new EmployeeSqlDAL(connectionString);

            List <Employee> employees = employeeDAL.GetEmployeesWithoutProjects();

            //Assert
            Assert.AreEqual(1, numOfEmployeesWithoutProjects);
        }
Ejemplo n.º 30
0
        public void TestSearch()
        {
            //Arrange
            EmployeeSqlDAL employeeDAL = new EmployeeSqlDAL(connectionString);

            //Act
            List <Employee> foundEmployee = employeeDAL.Search("Delora", "Coty");

            //Assert
            Assert.AreEqual(searchEmployee[0].EmployeeId, foundEmployee[0].EmployeeId);
        }