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");
            }
        }
Example #2
0
        public void SearchTest()
        {
            EmployeeSqlDAL  employee  = new EmployeeSqlDAL(connectionString);
            List <Employee> employees = employee.Search("Flo", "Henderson");

            Assert.AreEqual(1, employees.Count);
        }
        public void SearchEmployeeTest()
        {
            List <Employee> SearchTest = test.Search("Sid", "Goodman");

            Assert.AreEqual("Sid", SearchTest.First().FirstName);
            Assert.AreEqual("Goodman", SearchTest.First().LastName);
        }
Example #4
0
        public void EmployeeSearchTest()
        {
            EmployeeSqlDAL   employee = new EmployeeSqlDAL(connectionString);
            IList <Employee> restul   = employee.Search("John", "Fulton");

            Assert.IsNotNull(restul);
        }
Example #5
0
        public void SearchTest()
        {
            EmployeeSqlDAL eSQL = new EmployeeSqlDAL(connectionString);

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

            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");
        }
Example #7
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);
        }
Example #8
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);
        }
Example #9
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);
        }
        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);
        }
Example #11
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);
        }
        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 SearchTest() // good test
        {
            // Arrange
            EmployeeSqlDAL employeeSqlDAL = new EmployeeSqlDAL(connectionString);

            // act
            IList <Employee> employees = employeeSqlDAL.Search("Bobby", "Tables");

            // Assert
            Assert.IsNotNull(employees);
            Assert.AreEqual(employeeID, employees[0].EmployeeId);
        }
        public void SearchTest()
        {
            //Arrange
            EmployeeSqlDAL dal = new EmployeeSqlDAL(ConnectionString);

            //Act
            List <Employee> employees = dal.Search("First Name", "Last Name");

            //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);
        }
Example #15
0
        public void SearchTest()
        {
            EmployeeSqlDAL employee = new EmployeeSqlDAL(connectionString);
            Employee       person   = new Employee
            {
                FirstName    = "Kyle",
                LastName     = "Thomas",
                DepartmentId = 1,
                EmployeeId   = maxID,
                Gender       = "M",
                JobTitle     = "Liability",
                BirthDate    = new DateTime(1992, 10, 12),
                HireDate     = new DateTime(2017, 10, 12)
            };
            IList <Employee> list = employee.Search("Kyle", "Thomas");

            Assert.IsNotNull(list);
            CollectionAssert.ReferenceEquals(list[list.Count - 1], person);
        }
Example #16
0
        private void EmployeeSearch()
        {
            string firstname = CLIHelper.GetString("Enter the first name:");
            string lastname  = CLIHelper.GetString("Enter the last name:");

            EmployeeSqlDAL  dal       = new EmployeeSqlDAL(DatabaseConnection);
            List <Employee> employees = dal.Search(firstname, lastname);

            if (employees.Count > 0)
            {
                employees.ForEach(emp =>
                {
                    Console.WriteLine(emp);
                });
            }
            else
            {
                Console.WriteLine("**** NO RESULTS ****");
            }
        }
        private void EmployeeSearch()
        {
            string firstname = CLIHelper.GetString("Enter the first name:");
            string lastname  = CLIHelper.GetString("Enter the last name:");

            EmployeeSqlDAL   dal       = new EmployeeSqlDAL(DatabaseConnection);
            IList <Employee> employees = dal.Search(firstname, lastname);

            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 ****");
            }
        }