public async Task DeprioritizeCommandHandler_MissingTask_ReturnsEmptyList() { var command = new DeprioritizeCommand { ItemNumbers = new[] { 12 } }; var result = await _handler.Handle(command, new CancellationToken()); result.Should().NotBeNull(); result.Should().HaveCount(0); }
public async Task DeprioritizeCommandHandler_DepriorityIsWrittenToFile() { var command = new DeprioritizeCommand { ItemNumbers = new[] { 3 } }; _ = await _handler.Handle(command, new CancellationToken()); _taskFile.TaskLines[2].Should().Be("This is high priority"); }
public async Task DeprioritizeCommandHandler_RemovesBlankLinesFromTodoFile() { var command = new DeprioritizeCommand { ItemNumbers = new[] { 2 } }; _ = await _handler.Handle(command, new CancellationToken()); _taskFile.TaskLines.Should().HaveCount(7); }
public async Task DeprioritizeCommandHandler_RemovesMultiplePriorities() { var command = new DeprioritizeCommand { ItemNumbers = new[] { 3 } }; var result = await _handler.Handle(command, new CancellationToken()); result.Should().NotBeNull(); result.Should().HaveCount(1); result[0].Priority.Should().BeNull(); }
public async Task DeprioritizeCommandHandler_RemovesPriority() { var command = new DeprioritizeCommand { ItemNumbers = new[] { 3, 5, 6, 7, 8 } }; var result = await _handler.Handle(command, new CancellationToken()); result.Should().NotBeNull(); result.Should().HaveCount(5); result.First().Priority.Should().BeNull(); result.Last().Priority.Should().BeNull(); }
private async Task Deprioritize(int[] items) { var command = new DeprioritizeCommand { ItemNumbers = items }; var result = await Mediator.Send(command); foreach (var task in result) { Console.WriteLine(task.ToString(true)); Console.WriteLine($"TODO: {task.LineNumber} deprioritized."); } }