Пример #1
0
        public void GetTaskByIdTask()
        {
            ProjectManagerBL tb     = new ProjectManagerBL(dbContext.Object);
            Tasks            result = tb.GetTaskById(1);

            Assert.AreEqual(result.TaskId, 1);
        }
Пример #2
0
        public void EndTaskTest()
        {
            ProjectManagerBL tb     = new ProjectManagerBL(dbContext.Object);
            string           result = tb.EndTask(1);

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

            Tasks confirmResult = tb.GetTaskById(1);

            Assert.AreEqual(confirmResult.IsEnded, true);
        }
Пример #3
0
        public void AddTaskTest()
        {
            Tasks newTask = new Tasks()
            {
                TaskId = 7, Task = "Task 6", ParentTaskId = 0, Priority = 5, StartDate = new DateTime(), EndDate = new DateTime(), IsEnded = true, ProjectId = 1, UserId = 3
            };
            ProjectManagerBL tb     = new ProjectManagerBL(dbContext.Object);
            string           result = tb.AddTask(newTask);

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

            Tasks confirmResult = tb.GetTaskById(7);

            Assert.AreEqual(confirmResult, newTask);
        }
Пример #4
0
        public void UpdateTaskTest()
        {
            Tasks newTask = new Tasks()
            {
                TaskId = 5, Task = "Task5", ProjectId = 1, ParentTaskId = 1, Priority = 7, StartDate = new DateTime(), EndDate = new DateTime(), UserId = 1, IsEnded = true
            };
            ProjectManagerBL tb     = new ProjectManagerBL(dbContext.Object);
            string           result = tb.UpdateTask(newTask);

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

            Tasks confirmResult = tb.GetTaskById(5);

            Assert.AreEqual(confirmResult.Task, newTask.Task);
        }
Пример #5
0
        public void TestMethod8_GetTaskById()
        {
            DAL.Task taskObj = new DAL.Task()
            {
                Task_ID    = 100,
                Task_Name  = "Task1",
                Project_ID = 201,
                StartDate  = DateTime.Now,
                EndDate    = DateTime.Now,
                ParentTask = new DAL.ParentTask()
                {
                    Parent_ID = 100, Parent_Task = "Parent1"
                },
                Parent_ID = 100,
                Priority  = 10,
                Usrs      = new List <Usr> {
                    new Usr()
                    {
                        Usr_ID      = 100,
                        FirstName   = "Animesh",
                        LastName    = "Singh",
                        Project_ID  = 201,
                        Task_ID     = 100,
                        Employee_ID = 576113
                    }
                },
                Project = new Project()
                {
                    Project_ID = 201, Project_Name = "GICR", Priority = 10
                }
            };
            Mock <IProjectDbService> mock   = new Mock <IProjectDbService>();
            ProjectManagerBL         projBL = new ProjectManagerBL(mock.Object);

            mock.Setup(c => c.GetTaskById(It.IsAny <int>())).Returns(taskObj);

            // int expectedcount = 1;
            var actual = projBL.GetTaskById(100);

            Assert.AreEqual(100, actual.TaskID);
        }
Пример #6
0
        public IHttpActionResult GetTask(int id)
        {
            ProjectManagerBL obj = new ProjectManagerBL(_db);

            return(Ok(obj.GetTaskById(id)));
        }
Пример #7
0
 public Taskset GetTasksById(int id)
 {
     return(pbl.GetTaskById(id));
 }