Example #1
0
        public void TestGetAllByDeparmentId()
        {
            // Parameter named to avoid confusion.
            EmployeesService       service    = CreateService();
            IEnumerable <Employee> employees1 = service.GetAll(1);

            // The service must always return a collection, even when empty.
            Assert.NotNull(employees1);

            // The service must return two items according to test configuration.
            Assert.Equal(2, employees1.Count());

            Employee firstEmployee = employees1.First();

            //Checks if the employees are according to test configuration.
            Assert.Equal(1, firstEmployee.Id);
            Assert.Equal("Dan", firstEmployee.FirstName);
            Assert.Equal("Loden", firstEmployee.LastName);
            Assert.Equal("Nature Inspector", firstEmployee.JobTitle);
            Assert.Equal("4652 Bates Brothers Road Hilliard, OH 43026", firstEmployee.MailingAddress);

            // Second test is to assert that the filter was not a lucky hit.
            IEnumerable <Employee> employees2 = service.GetAll(2);

            Assert.NotNull(employees2);
            Assert.Equal(2, employees2.Count());
            Employee firstEmployee2 = employees2.First();

            Assert.Equal(3, firstEmployee2.Id);
            Assert.Equal("Teresa", firstEmployee2.FirstName);
            Assert.Equal("Hill", firstEmployee2.LastName);
            Assert.Equal("Construction Equipment Technician", firstEmployee2.JobTitle);
            Assert.Equal("3789 Cook Hill Road Stamford, CT 06995", firstEmployee2.MailingAddress);
        }
Example #2
0
        // GET: Admin/AdminEmployees
        public ActionResult Index()
        {
            var modelView = new AdminEmployeesViewModel
            {
                ListEmployees = _employeesService.GetAll()
            };

            return(View(modelView));
        }
Example #3
0
        public ActionResult OnlineOrder()
        {
            var modelView = new EmployeesViewModel
            {
                employeesRoles = _employeesRoleService.GetAll(),
                employees      = _employeesService.GetAll(),
            };

            return(PartialView(modelView));
        }
Example #4
0
        public void TestGetAll()
        {
            EmployeesService       service   = CreateService();
            IEnumerable <Employee> employees = service.GetAll();

            // The service must always return a collection, even when empty.
            Assert.NotNull(employees);

            // The service must return four items according to test configuration.
            Assert.Equal(4, employees.Count());
        }
Example #5
0
        public void TestGetAllByDepartmentIdNonExisting()
        {
            EmployeesService       service   = CreateService();
            IEnumerable <Employee> employees = service.GetAll(3);

            // The service must always return a collection, even when empty.
            Assert.NotNull(employees);

            // The service must return no items according to test configuration.
            Assert.Empty(employees);
        }
Example #6
0
        public void TestGetAllEmptyNoEmployees()
        {
            // Parameter named to avoid confusion.
            EmployeesService       service   = CreateService(empty: true);
            IEnumerable <Employee> employees = service.GetAll();

            // The service must always return a collection, even when empty.
            Assert.NotNull(employees);

            // The service must return no items according to test configuration.
            Assert.Empty(employees);
        }
 private void UpdateDataGrid()
 {
     dataGrid.Rows.Clear();
     _empService.GetAll().ToList().ForEach(emp => dataGrid.Rows.Add(
                                               emp.Id,
                                               string.Join(" ", emp.Surname, emp.Name, emp.Patronymic),
                                               emp.Phone,
                                               emp.Birthday,
                                               emp.Email,
                                               emp.UserTypeToString()
                                               ));
 }
Example #8
0
 public IActionResult GetAll() => Json(_service.GetAll());
 public IHttpActionResult Get()
 {
     return(Ok(_service.GetAll()));
 }