private void MoveDownCommand_Executed(object sender, RoutedEventArgs e) { MoveTaskCommand DownClick = new MoveTaskCommand(this, false); DownClick.Execute(); this.ViewableTasks.View.Refresh(); }
private void MoveUpCommand_Executed(object sender, RoutedEventArgs e) { MoveTaskCommand UpClick = new MoveTaskCommand(this, true); UpClick.Execute(); this.ViewableTasks.View.Refresh(); }
public async Task Execute_ThrowsResourceNotFoundExceptionOnNoMatchingTask() { var repo = new Mock <IListRepository>(); var taskId = Guid.NewGuid().ToString(); var fromListId = Guid.NewGuid().ToString(); var toListId = Guid.NewGuid().ToString(); var fromList = new List { Id = fromListId, Tasks = new List <Domain.Task>() }; var toList = new List { Id = fromListId, Tasks = new List <Domain.Task>() }; var command = new MoveTaskCommand { FromListId = fromListId, ToListId = toListId, TaskId = taskId }; var handler = new MoveTaskCommandHandler(repo.Object); repo.Setup(r => r.GetById(fromListId)).ReturnsAsync(fromList); repo.Setup(r => r.GetById(toListId)).ReturnsAsync(toList); await Assert.ThrowsExceptionAsync <ResourceNotFoundException>(() => handler.Execute(command)); }
public bool MoveTask(MoveTaskCommand command) { Task task = _taskRepository.GetTask(command.TaskId); task.ColumnId = command.ColumnId; return(_taskRepository.Save()); }
public static async Task <IActionResult> Run( [HttpTrigger(AuthorizationLevel.Anonymous, "put", Route = "list/{listid}/task/{taskid}/parent")] ParentDTO parent, string listid, string taskid) { try { var command = new MoveTaskCommand { FromListId = listid, ToListId = parent.Id, TaskId = taskid }; var handler = Container.GetInstance <ICommandHander <MoveTaskCommand> >(); await handler.Execute(command); return(new NoContentResult()); } catch (ResourceNotFoundException ex) { Container.GetInstance <TelemetryClient>().TrackException(ex); return(new NotFoundResult()); } catch (Exception ex) { Container.GetInstance <TelemetryClient>().TrackException(ex); return(new InternalServerErrorResult()); } }
public IActionResult MoveTask([FromRoute] int?projectId, [FromBody] MoveTaskCommand command) { if (!_projectService.IsUserAUser(projectId, UserHelper.GetUserId(HttpContext.User))) { return(Forbid()); } bool moved = _boardService.MoveTask(command); if (moved) { return(Ok()); } return(BadRequest()); }
public void ClientMoveTaskRequest(int RandomID, bool Direction) { Console.WriteLine("Received request to: Move task " + RandomID + "Direction: " + Direction.ToString()); User mUser = FindUser(Context.ConnectionId); if (mUser.Tasks.Count == 0) { EmptyListBroadcast(); return; } MoveTaskCommand mMoveTask = new MoveTaskCommand(mUser, RandomID, Direction); mMoveTask.Execute(); Clients.Clients(mUser.ConnectionIDs).ReceiveUpdatedTasks(mUser.Tasks); }
public async Task Execute_MovesTaskOnSuccess() { var repo = new Mock <IListRepository>(); var taskId = Guid.NewGuid().ToString(); var fromListId = Guid.NewGuid().ToString(); var toListId = Guid.NewGuid().ToString(); var task = new Domain.Task { Id = taskId }; var fromList = new List { Id = fromListId, Tasks = new List <Domain.Task> { task } }; var toList = new List { Id = fromListId, Tasks = new List <Domain.Task>() }; var command = new MoveTaskCommand { FromListId = fromListId, ToListId = toListId, TaskId = taskId }; var handler = new MoveTaskCommandHandler(repo.Object); repo.Setup(r => r.GetById(fromListId)).ReturnsAsync(fromList); repo.Setup(r => r.GetById(toListId)).ReturnsAsync(toList); await handler.Execute(command); Assert.AreEqual(0, fromList.Tasks.Count); Assert.AreEqual(1, toList.Tasks.Count); Assert.IsTrue(toList.Tasks.Contains(task)); }
public async Task Execute_ReturnsCompletedTaskOnSuccess() { var repo = new Mock <IListRepository>(); var taskId = Guid.NewGuid().ToString(); var fromListId = Guid.NewGuid().ToString(); var toListId = Guid.NewGuid().ToString(); var fromList = new List { Id = fromListId, Tasks = new List <Domain.Task> { new Domain.Task { Id = taskId } } }; var toList = new List { Id = fromListId, Tasks = new List <Domain.Task>() }; var command = new MoveTaskCommand { FromListId = fromListId, ToListId = toListId, TaskId = taskId }; var handler = new MoveTaskCommandHandler(repo.Object); repo.Setup(r => r.GetById(fromListId)).ReturnsAsync(fromList); repo.Setup(r => r.GetById(toListId)).ReturnsAsync(toList); var result = handler.Execute(command); await result; Assert.AreEqual(true, result.IsCompleted); }