public void GetEmployeesTest()
        {
            // Arrange.
            IEmployeeFactory empFactory = new EmployeeFactory();
            IDBContext       dbContext  = new DBContext();

            // Act.
            List <EmployeeModel> employees = dbContext
                                             .GetEmployees()
                                             .Select(emp => empFactory.GetEmployeeModelFromEmployee(emp))
                                             .ToList();

            // Assert.
            Assert.IsNotNull(employees);
            Assert.AreEqual(100, employees.Count);
        }
Exemple #2
0
        public void GetEmployeeModelFromEmployeeTest()
        {
            // Arrange.
            Employee emp = new Employee()
            {
                EmployeeId   = 1,
                EmployeeName = "A",
                Department   = "R&D"
            };

            // Act.
            EmployeeFactory empFactory = new EmployeeFactory();
            var             empModel   = empFactory.GetEmployeeModelFromEmployee(emp);

            // Assert.
            Assert.IsNotNull(empModel);
            Assert.IsInstanceOfType(empModel, typeof(EmployeeModel));
            Assert.AreEqual(emp.EmployeeId, empModel.EmployeeId);
            Assert.AreEqual(emp.EmployeeName, empModel.EmployeeName);
            Assert.AreEqual(emp.Department, empModel.Department);
        }