Beispiel #1
0
        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);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        public IHttpActionResult AddProject([FromBody] ProjectMangerModel.Projects project)
        {
            try
            {
                CommonEntities.Projects proj = new CommonEntities.Projects
                {
                    ProjectName = project.ProjectName,
                    StartDate   = project.StartDate,
                    EndDate     = project.EndDate,
                    Priority    = project.Priority,
                    ManagerID   = project.ManagerID
                };

                _projectBL.AddProject(proj);
                return(Ok());
            }
            catch
            {
                return(InternalServerError());
            }
        }