public HttpResponseMessage Post(Employee employee)
        {
            if (ModelState.IsValid)
            {
                _employeeRepository.Add(employee);

                _unitOfWork.SaveChanges();

                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, employee);
               // response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = employee.EmployeeID }));
                return response;
            }
            else
            {
                return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState);
            }
        }
        public void The_Add_Employee_Action_Returns_ViewResult_When_The_Employee_Model_Is_Invalid()
        {
            // Arrange
            const string expectedRouteName = "EmployeeCreated";
            var employee = new Employee()
            {
                EmployeeID = 1,
                Name = "Aimen",
                Address = "Address",
                Age = 1,
                Employment = 1,
                Active = 1
            };

            var employeesController = new EmployeesController(_mockER.Object, _mockUW.Object);
            employeesController.ModelState.AddModelError("A Error", "Message");
            // Act
            var result = employeesController.Create(employee) as RedirectToRouteResult;

            // Assert
            Assert.AreEqual(3, _data.Count());
            Assert.IsNull(result, "Should have returned a RedirectToRouteResult");
        }
        public void The_Delete_Employee_Action_Returns_RedirectToRouteResult_When_The_Employee_Model_Is_Valid()
        {
            // Arrange
            const string expectedRouteName = "EmployeeDeleted";
            var employee = new Employee()
            {
                EmployeeID = 1,

            };

            var employeesController = new EmployeesController(_mockER.Object, _mockUW.Object);
            var routeData = new RouteData();
            employeesController.ControllerContext =
                new ControllerContext(_mockHttpContext.Object, routeData, employeesController);

            employeesController.ModelState.Clear();
            // Act
            var result = employeesController.DeleteConfirmed(1) as RedirectToRouteResult;

            // Assert
            Assert.AreEqual(2, _data.Count());
            Assert.IsNotNull(result, "Should have returned a RedirectToRouteResult");
            // Assert.AreEqual(expectedRouteName, result.RouteName, "Route name should have been {0}", expectedRouteName);
        }
        public void The_Add_Employee_Action_Returns_RedirectToRouteResult_When_The_Employee_Model_Is_Valid()
        {
            // Arrange
            const string expectedRouteName = "EmployeeCreated";
            var employee = new Employee()
            {
                EmployeeID = 1,
                Name = "Aimen",
                Address = "Address",
                Age = 1,
                Employment = 1,
                Active = 1
            };

            var employeesController = new EmployeesController(_mockER.Object, _mockUW.Object);
            var routeData = new RouteData();
            _FormKeys.Add("Create", "Create");
            employeesController.ControllerContext =
                new ControllerContext(_mockHttpContext.Object, routeData, employeesController);
            employeesController.ModelState.Clear();
            // Act
            var result = employeesController.Create(employee) as RedirectToRouteResult;

            // Assert
            Assert.AreEqual(4, _data.Count());
            Assert.IsNotNull(result, "Should have returned a RedirectToRouteResult");
            // Assert.AreEqual(expectedRouteName, result.RouteName, "Route name should have been {0}", expectedRouteName);
        }