public void UpdateProjectTest_Success() { // Arrange ProjectMangerModel.Projects model = new ProjectMangerModel.Projects { ProjectID = 1, Project = "Project 1", StartDate = DateTime.Now.Date, EndDate = DateTime.Now.Date.AddDays(2) }; // Act var response = projectsController.UpdateProject(model); // Assert Assert.IsTrue(response is OkResult); }
public void AddProjectTest_Error() { // Arrange var projectController = new ProjectsController(null); ProjectMangerModel.Projects model = new ProjectMangerModel.Projects { ProjectID = 4, Project = "Project 4", StartDate = DateTime.Now.Date, EndDate = DateTime.Now.Date.AddDays(1) }; // Act var response = projectController.AddProject(model); // Assert Assert.IsTrue(response is InternalServerErrorResult); }
public IHttpActionResult AddProject([FromBody] ProjectMangerModel.Projects project) { try { CommonEntities.Projects proj = new CommonEntities.Projects { Project = project.Project, StartDate = project.StartDate, EndDate = project.EndDate, Priority = project.Priority, ManagerID = project.ManagerID }; _projectBL.AddProject(proj); return(Ok()); } catch (Exception) { return(InternalServerError()); } }