Exemplo n.º 1
0
        public void Test_ProjectGet(string projectName, int ProjectID)
        {
            var controller = new ProjectAPIController();

            List <ProjectDetailModel> resoponse = controller.Get();
            var result = resoponse.Where(t => t.PDProjectID == ProjectID).FirstOrDefault();

            Assert.AreEqual(projectName, result.PDProjectName);
        }
Exemplo n.º 2
0
        public void Test_ProjectPost(ProjectModel projectModel)
        {
            var controller = new ProjectAPIController();

            controller.Post(projectModel);
            List <ProjectDetailModel> resoponse = controller.Get();
            var result = resoponse.Where(t => t.PDProjectID == projectModel.Project_ID).FirstOrDefault();

            Assert.AreEqual(projectModel.Project, result.PDProjectName);
        }
Exemplo n.º 3
0
        public void GetProjectById_ShouldReturnCorrentProject()
        {
            TaskManagerEntities  taskManagerEntities = new TaskManagerEntities();
            ProjectAPIController controller          = new ProjectAPIController();
            var ProjectId = taskManagerEntities.Projects.Max(x => x.Project_Id);

            var result = controller.GetProjectbyId(ProjectId);

            Assert.IsNotNull(result);
            Assert.AreEqual(result.Project_Id, ProjectId);
        }
Exemplo n.º 4
0
        public void GetProjectDetails_ShouldReturnAllProject()
        {
            TaskManagerEntities entity = new TaskManagerEntities();
            var ActualResult           = entity.Projects.ToList();

            ProjectAPIController controller = new ProjectAPIController();

            var APIResult = controller.GetProjectDetails();

            //Assert.IsNotNull(APIResult);
            Assert.AreEqual(ActualResult.Count(), APIResult.Count());
        }
Exemplo n.º 5
0
        public void Delete_ProjectShouldBeDeleted()
        {
            TaskManagerEntities taskManagerEntities = new TaskManagerEntities();
            var ProjectId = taskManagerEntities.Projects.Max(x => x.Project_Id);


            ProjectAPIController controller = new ProjectAPIController();

            controller.Delete(ProjectId);

            var result = controller.GetProjectDetails().Where(x => x.ProjectId == ProjectId).FirstOrDefault();


            Assert.IsNull(result);
        }
Exemplo n.º 6
0
        public void CreateProject_ProjectShouldBeAdded()
        {
            Project project = new Project();

            project.Name       = "Test Project";
            project.Priority   = 5;
            project.Manager_Id = 1;
            project.Start_Date = Convert.ToDateTime("01-02-2018");
            project.End_Date   = Convert.ToDateTime("04-02-2018");


            ProjectAPIController controller = new ProjectAPIController();

            controller.Create(project);

            var result = controller.GetProjectDetails().Where(x => x.Name == "Test Project").FirstOrDefault();

            Assert.IsNotNull(result);
            Assert.AreEqual(result.Name, "Test Project");
        }
Exemplo n.º 7
0
        public void Test_ProjectDelete(int ProjectID)
        {
            var controller = new ProjectAPIController();
            List <ProjectDetailModel> resoponse = controller.Get();
            var          result  = resoponse.Where(t => t.PDProjectID == ProjectID).FirstOrDefault();
            ProjectModel project = new ProjectModel()
            {
                UserID     = result.UserID,
                Priority   = result.PDPriority,
                Project    = result.PDProjectName,
                Project_ID = result.PDProjectID,
                StartDate  = result.PDStartDate,
                EndDate    = result.PDEndDate
            };

            controller.Delete(project);
            List <ProjectDetailModel> resoponse2 = controller.Get();
            var result2 = resoponse2.Where(t => t.PDProjectID == ProjectID).FirstOrDefault();

            Assert.That(result2, Is.Null);
        }
Exemplo n.º 8
0
        public void Test_ProjectPut(string projectName, int Project_ID)
        {
            var controller = new ProjectAPIController();
            List <ProjectDetailModel> resoponse = controller.Get();
            var          result  = resoponse.Where(t => t.PDProjectID == Project_ID).FirstOrDefault();
            ProjectModel project = new ProjectModel()
            {
                UserID     = result.UserID,
                Priority   = result.PDPriority,
                Project    = projectName,
                Project_ID = result.PDProjectID,
                StartDate  = result.PDStartDate,
                EndDate    = result.PDEndDate
            };

            controller.Put(project);
            List <ProjectDetailModel> resoponse2 = controller.Get();
            var result2 = resoponse2.Where(t => t.PDProjectID == Project_ID).FirstOrDefault();

            Assert.AreEqual(projectName, result2.PDProjectName);
        }
Exemplo n.º 9
0
        public void UpdateProject_ProjectShouldBeUpdated()
        {
            TaskManagerEntities taskManagerEntities = new TaskManagerEntities();
            var     ProjectId = taskManagerEntities.Projects.Max(x => x.Project_Id);
            Project project   = new Project();

            project.Project_Id = ProjectId;
            project.Name       = "Updated Test Project";
            project.Manager_Id = 1;
            project.Priority   = 14;
            project.Start_Date = Convert.ToDateTime("01-02-2018");
            project.End_Date   = Convert.ToDateTime("04-02-2018");

            ProjectAPIController controller = new ProjectAPIController();

            controller.Update(project);

            var result = controller.GetProjectDetails().Where(x => x.ProjectId == ProjectId).FirstOrDefault();

            Assert.IsNotNull(result);
            Assert.AreEqual(result.Name, "Updated Test Project");
        }