public void Task_Service_GetAll_Method_To_GetAll_Request()
        {
            //Arrange
            List <TaskBacklogView> taskv = new List <TaskBacklogView>()
            {
                new TaskBacklogView()
                {
                    SprintId = 1
                }
            };
            List <TaskBacklog> requests = new List <TaskBacklog>();
            var request = new TaskBacklog();

            request.SprintId = 1;
            requests.Add(request);
            //mocking RequestRepository
            var mockRepoReq = new Mock <ITaskRepository>();

            //mocking GetAll() of RequestRepository
            mockRepoReq.Setup(x => x.GetAll(1)).Returns(requests);
            TaskService obj = new TaskService(mockRepoReq.Object);
            //Act
            var res = obj.GetAll(1);

            //Assert
            Assert.NotNull(res);
            Assert.Equal(taskv[0].SprintId, res[0].SprintId);
        }
示例#2
0
        public void Update_RemainingTime(ChecklistBacklog checklist)
        {
            TaskBacklog task = _context.Tasks.FirstOrDefault(m => m.TaskId == checklist.TaskId);

            task.Remaining = task.PlannedSize - checklist.RemainingSize;
            _context.SaveChanges();
        }
示例#3
0
        public void Update(int memberId, int TaskId)
        {
            TaskBacklog task = _context.Tasks.FirstOrDefault(p => p.TaskId == TaskId);

            task.PersonId = memberId;
            task.Status   = TaskBacklogStatus.Inprogress;
            _context.SaveChanges();
        }
示例#4
0
        //updates the task for the task id.
        public Task UpdateTask(int sprintId, TaskBacklog task)
        {
            int projectId = _service.GetProjectId(sprintId);

            JoinGroup(projectId);
            _service.Update(task.TaskId, task);
            return(Clients.Group("TaskGroup").InvokeAsync("whenUpdated", projectId));
        }
示例#5
0
        //Add a task to the DB.
        public Task PostTask(TaskBacklog task, int sprintId)
        {
            int projectId = _service.GetProjectId(sprintId);

            JoinGroup(projectId);
            _service.Add(task);
            return(Clients.Group("TaskGroup").InvokeAsync("whenAdded", projectId));
        }
示例#6
0
        public void Update(int id, TaskBacklog bklog)
        {
            TaskBacklog data = _context.Tasks.FirstOrDefault(m => m.TaskId == id);

            data.Title = bklog.Title;

            //  data. = bklog.Comments;
            _context.SaveChanges();
        }
示例#7
0
 public ExecutionContext(
     IExecutionTaskContext taskContext,
     ObjectPool <ResolverTask> resolverTaskPool)
 {
     _taskContext                 = taskContext;
     _taskStatistics              = new TaskStatistics();
     _taskBacklog                 = new TaskBacklog(_taskStatistics, resolverTaskPool);
     TaskPool                     = resolverTaskPool;
     TaskStats.StateChanged      += TaskStatisticsEventHandler;
     TaskStats.AllTasksCompleted += OnCompleted;
 }
 public IActionResult GetTaskDetail(int id) //Method for getting checklist by Id
 {
     try
     {
         TaskBacklog taskbl = _context.GetTaskDetail(id);
         return(Ok(taskbl));// returns a response code of 200
     }
     catch
     {
         return(BadRequest());// returns a response code of 400 if Exception
     }
 }
示例#9
0
        private void TryDispatchBatches()
        {
            if (TaskBacklog.IsEmpty && BatchDispatcher.HasTasks)
            {
                BatchDispatcher.Dispatch(Register);
            }

            void Register(IExecutionTaskDefinition taskDefinition)
            {
                TaskBacklog.Register(taskDefinition.Create(_taskContext));
            }
        }
示例#10
0
        public void Backlog_serive_Add_method_throw_exception_with_invalid_value_type()
        {
            TaskBacklog task = new TaskBacklog();

            task.PersonId = 1;
            var mockrepo = new Mock <ITaskBacklogReposiory>();

            mockrepo.Setup(x => x.Update(1, 1)).Throws(new NullReferenceException());
            TaskBacklogService obj = new TaskBacklogService(mockrepo.Object);
            var exception          = Record.Exception(() => obj.UpdateTask(1, 1));

            Assert.IsType <NullReferenceException>(exception);
        }
示例#11
0
        public void Checklist_Service_GetTaskDetail()
        {
            //Arrange
            TaskBacklog tasks = new TaskBacklog();

            tasks.TaskId = 1;
            var mockRepoCheck = new Mock <ICheckListRepository>();

            mockRepoCheck.Setup(x => x.GetTaskDetail(1)).Returns(tasks);
            ChecklistService obj = new ChecklistService(mockRepoCheck.Object);
            //Act
            var res = obj.GetTaskDetail(1);

            //Assert
            Assert.NotNull(res);
            Assert.Equal(tasks, res);
        }
        public void Task_Service_Update_Method_Throws_NullReferenceException_With_Invalid_ValueType()
        {
            //Arrange
            TaskBacklog Backlog = new TaskBacklog();

            Backlog.SprintId = 1;
            TaskBacklog Backlog1 = new TaskBacklog();

            Backlog.SprintId = 2;
            var request  = new TaskBacklog();
            var mockRepo = new Mock <ITaskRepository>();

            mockRepo.Setup(x => x.Update(It.IsAny <int>(), Backlog)).Throws(new NullReferenceException());
            TaskService obj       = new TaskService(mockRepo.Object);
            var         exception = Record.Exception(() => obj.Update(It.IsAny <int>(), Backlog));

            Assert.IsType <NullReferenceException>(exception);
        }
        public void Task_Service_SetConnetionId_Method_Throws_FormatException_With_Invalid_ValueType()
        {
            //Arrange
            TaskBacklog Backlog = new TaskBacklog();

            Backlog.SprintId = 1;
            TaskBacklog Backlog1 = new TaskBacklog();

            Backlog.SprintId = 2;
            var request  = new TaskBacklog();
            var mockRepo = new Mock <ITaskRepository>();

            mockRepo.Setup(x => x.SetConnectionId(It.IsAny <string>(), It.IsAny <int>())).Throws(new FormatException());
            TaskService obj       = new TaskService(mockRepo.Object);
            var         exception = Record.Exception(() => obj.SetConnectionId(It.IsAny <string>(), It.IsAny <int>()));

            Assert.IsType <FormatException>(exception);
        }
        public void Task_Service_GetAll_Method_To_GetAll_Request_Type_Object()
        {
            //Arrange
            List <TaskBacklog> requests = new List <TaskBacklog>();
            var request = new TaskBacklog();

            request.SprintId = 1;
            requests.Add(request);
            //mocking RequestRepository
            var mockRepoReq = new Mock <ITaskRepository>();

            //mocking GetAll() of RequestRepository
            mockRepoReq.Setup(x => x.GetAll(1)).Returns(requests);
            TaskService obj = new TaskService(mockRepoReq.Object);
            //Act
            var res = obj.GetAll(1);

            //Assert
            Assert.IsType <List <TaskBacklogView> >(res);
        }
        public void Task_Service_GetProjectId_Method_Should_Return_Type_Object()
        {
            //Arrange
            List <TaskBacklog> requests = new List <TaskBacklog>();
            var request = new TaskBacklog();

            request.TaskId = 1;
            requests.Add(request);
            var r = new Sprint();
            //mocking RequestRepository
            var mockRepoReq = new Mock <ITaskRepository>();

            mockRepoReq.Setup(x => x.GetProjectId(It.IsAny <int>())).Returns(r);
            TaskService obj = new TaskService(mockRepoReq.Object);
            //Act
            var res = obj.GetProjectId(1);

            //Assert
            Assert.IsType <int>(res);
        }
示例#16
0
        public void SignUpServiceUnitTest_to_GetAllTaskDetail_for_NotNull()
        {
            //Arrange
            List <TaskBacklog>     tasks = new List <TaskBacklog>();
            List <TaskBacklogView> taskv = new List <TaskBacklogView>();
            var task = new TaskBacklog()
            {
                TaskId = 1
            };

            tasks.Add(task);
            var mockRepoTask = new Mock <ITaskBacklogReposiory>();

            mockRepoTask.Setup(x => x.GetAllTaskDetail(1)).Returns(tasks);
            TaskBacklogService obj = new TaskBacklogService(mockRepoTask.Object);
            //Act
            var res = obj.GetAllTask(1);

            //Assert
            Assert.Equal(1, res.Count);
        }
示例#17
0
 //check status of all task
 public void CheckAllChecklistStatus(int checklistId)
 {
     try
     {
         int count = 0;
         //get the checklist from Checklist Id.
         var checklist = _context.Checklistbl.FirstOrDefault(m => m.ChecklistId == checklistId);
         //get all checklists from the taskId.
         List <ChecklistBacklog> backlogs = _context.Checklistbl.Where(m => m.TaskId == checklist.TaskId).ToList();
         //checking status of all the checklist backlogs.
         foreach (var item in backlogs)
         {
             if (item.Status == true)
             {
                 count++;
             }
         }
         if (count == backlogs.Count)
         {
             //if all tasks are completed
             TaskCompleted(checklist.TaskId);
         }
         else
         {
             //change status to Inprogress in case of undoing checklist
             TaskBacklog taskblog = _context.Tasks.FirstOrDefault(m => m.TaskId == checklist.TaskId);
             taskblog.Status = TaskBacklogStatus.Inprogress;
             _context.SaveChanges();
             CheckAllTaskStatus(taskblog.TaskId);
         }
     }
     catch (Exception)
     {
         throw new Exception();
     }
 }
示例#18
0
 public TaskBacklogBuilder()
 {
     _taskBacklog = ScriptableObject.CreateInstance <TaskBacklog>();
 }
示例#19
0
 public void Add(TaskBacklog bklog)
 {
     _context.Tasks.Add(bklog);
     _context.SaveChanges();
 }
 public void Post([FromBody] TaskBacklog backlog)
 {
     _service.Add(backlog);
 }
示例#21
0
 public void Update(int id, TaskBacklog res)
 {
     _repository.Update(id, res);
 }
示例#22
0
 public void Add(TaskBacklog backlog)
 {
     _repository.Add(backlog);
 }
 public void put(int id, [FromBody] TaskBacklog value)
 {
 }