예제 #1
0
        public void GetProjectByIdTest()
        {
            ProjectManagerBL tb     = new ProjectManagerBL(dbContext.Object);
            Projects         result = tb.GetProjectById(1);

            Assert.AreEqual(result.ProjectId, 1);
        }
예제 #2
0
        public void SuspendProjectTest()
        {
            ProjectManagerBL tb     = new ProjectManagerBL(dbContext.Object);
            string           result = tb.SuspendProject(1);

            dbContext.Verify(x => x.SaveChanges());
            Assert.AreEqual(result, "Project Suspended Successfully");

            Projects confirmResult = tb.GetProjectById(1);

            Assert.AreEqual(confirmResult.IsSuspended, true);
        }
예제 #3
0
        public void AddProjectTest()
        {
            Projects newProject = new Projects()
            {
                ProjectId = 4, ProjectName = "MEDICAL", StartDate = new DateTime(), EndDate = new DateTime(), ManagerId = 1, Priority = 13, IsSuspended = false
            };
            ProjectManagerBL tb     = new ProjectManagerBL(dbContext.Object);
            string           result = tb.AddProject(newProject);

            Assert.AreEqual(result, "Project Added Successfully");

            Projects confirmResult = tb.GetProjectById(4);

            Assert.AreEqual(confirmResult, newProject);
        }
예제 #4
0
        public void UpdateProjectTest()
        {
            Projects newProject = new Projects()
            {
                ProjectId = 3, ProjectName = "BANKING", StartDate = new DateTime(), EndDate = new DateTime(), ManagerId = 3, Priority = 15, IsSuspended = true
            };
            ProjectManagerBL tb     = new ProjectManagerBL(dbContext.Object);
            string           result = tb.UpdateProject(newProject);

            dbContext.Verify(x => x.SaveChanges());
            Assert.AreEqual(result, "Project Updated Successfully");

            Projects confirmResult = tb.GetProjectById(3);

            Assert.AreEqual(confirmResult.ProjectName, newProject.ProjectName);
        }
예제 #5
0
        public IHttpActionResult GetProject(int id)
        {
            ProjectManagerBL obj = new ProjectManagerBL(_db);

            return(Ok(obj.GetProjectById(id)));
        }
예제 #6
0
 public Projectset GetProjectById(int id)
 {
     return(pbl.GetProjectById(id));;
 }