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");
            }
        }
Пример #2
0
        public void GetAllEmployeesTest()
        {
            EmployeeSqlDAL  testEmployee = new EmployeeSqlDAL(connectionString);
            List <Employee> testList     = testEmployee.GetAllEmployees();

            Assert.AreEqual(numOfEmployee, testList.Count);
        }
Пример #3
0
        public void GetAllEmployeesTest()
        {
            EmployeeSqlDAL  employee  = new EmployeeSqlDAL(connectionString);
            List <Employee> employees = employee.GetAllEmployees();

            Assert.AreEqual(12, employees.Count);
        }
        public void GetEmployeesTest()
        {
            List <Employee> GetEmployees = test.GetAllEmployees();

            Assert.AreEqual(13, GetEmployees.Count);
            Assert.AreEqual(employeeID, GetEmployees[GetEmployees.Count - 1].EmployeeId);
        }
Пример #5
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);
        }
Пример #6
0
        public void GetAllEmployeesTest()
        {
            EmployeeSqlDAL   employee = new EmployeeSqlDAL(connectionString);
            IList <Employee> names    = employee.GetAllEmployees();

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

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

            Assert.AreEqual(numberOfEmployees, employees.Count);
        }
Пример #8
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 ShowEmployees()
        {
            EmployeeSqlDAL  employeeSqlDal = new EmployeeSqlDAL(connectionString);
            List <Employee> employees      = employeeSqlDal.GetAllEmployees();

            Assert.IsNotNull(employees);
            Assert.AreEqual(numOfEmployee, employees.Count - 1);
        }
Пример #10
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);
        }
Пример #11
0
        public void GetAllEmployeesTest()
        {
            EmployeeSqlDAL eSQL = new EmployeeSqlDAL(connectionString);

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

            Assert.IsNotNull(e);
        }
        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);
        }
Пример #13
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);
        }
        public void GetAllEmployeesTest()
        {
            EmployeeSqlDAL  newEmployee   = new EmployeeSqlDAL(connectionString);
            List <Employee> employeesList = newEmployee.GetAllEmployees();

            employees++;

            Assert.IsNotNull(employeesList);
            Assert.AreEqual(employees, employeesList.Count);
        }
Пример #15
0
        public void TestGetAllEmployees()
        {
            //Arrange
            EmployeeSqlDAL employeeDAL = new EmployeeSqlDAL(connectionString);

            //Act
            List <Employee> employees = employeeDAL.GetAllEmployees();

            //Assert
            Assert.AreEqual(employeeCount, employees.Count);
        }
        public void EmployeeTest()
        {
            EmployeeSqlDAL  esdTest        = new EmployeeSqlDAL(connectionString);
            List <Employee> happyEmployees = esdTest.GetAllEmployees();

            Assert.AreEqual(headCount, 12);

            Assert.AreEqual(1, esdTest.Search(firstN, lastN).Count);    //  EMployee ID = 1, only employee with that first and last anme

            Assert.AreEqual(projless, esdTest.GetEmployeesWithoutProjects().Count);
        }
        public void GetAllEmployeesTest() // good test
        {
            // Arrange
            EmployeeSqlDAL employeeSqlDAL = new EmployeeSqlDAL(connectionString);

            // act
            IList <Employee> employees = employeeSqlDAL.GetAllEmployees();

            // Assert
            Assert.IsNotNull(employees);
            Assert.AreEqual(numberOfEmployees + 1, employees.Count);
        }
Пример #18
0
        private void GetAllEmployees()
        {
            EmployeeSqlDAL  dal       = new EmployeeSqlDAL(DatabaseConnection);
            List <Employee> employees = dal.GetAllEmployees();

            if (employees.Count > 0)
            {
                employees.ForEach(emp =>
                {
                    Console.WriteLine(emp);
                });
            }
            else
            {
                Console.WriteLine("**** NO RESULTS ****");
            }
        }
        private void GetAllEmployees()
        {
            EmployeeSqlDAL   dal       = new EmployeeSqlDAL(DatabaseConnection);
            IList <Employee> employees = dal.GetAllEmployees();

            if (employees.Count > 0)
            {
                foreach (Employee emp in employees)
                {
                    Console.WriteLine(emp.EmployeeId.ToString().PadRight(5) + (emp.LastName + ", " + emp.FirstName).PadRight(30) + emp.JobTitle.PadRight(30) + emp.Gender.PadRight(3) + emp.BirthDate.ToShortDateString().PadRight(10));
                }
            }
            else
            {
                Console.WriteLine("**** NO RESULTS ****");
            }
        }
Пример #20
0
        public void GetAllEmployeesTest()
        {
            EmployeeSqlDAL   employee = new EmployeeSqlDAL(connectionString);
            IList <Employee> result   = employee.GetAllEmployees();

            Assert.IsNotNull(result);

            bool areEqual = false;

            foreach (Employee id in result)
            {
                if (id.LastName == "Fulton")
                {
                    areEqual = true;
                }
            }
            Assert.IsTrue(areEqual);
        }
        public void GetAllEmployeesTest()
        {
            //Arrange
            EmployeeSqlDAL dal = new EmployeeSqlDAL(ConnectionString);

            //Act
            List <Employee> employees = dal.GetAllEmployees();

            //Assert
            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);
        }