public async Task ListPriorityQueryHandler_ReturnsAllTasksWithoutBlanksWithoutSearchTerms()
        {
            var command = new ListPriorityQuery {
                Priorities = "A-Z", Terms = new string[0]
            };
            ListPriorityResponse result = await _handler.Handle(command, new CancellationToken());

            result.Tasks.Should().HaveCount(7);
        }
        public async Task ListPriorityQueryHandler_ReturnsSinglePriority()
        {
            var command = new ListPriorityQuery {
                Priorities = "B", Terms = new string[0]
            };
            ListPriorityResponse result = await _handler.Handle(command, new CancellationToken());

            result.Tasks.Should().HaveCount(2);
            result.Tasks.First().Text.Should().StartWith("(B) ");
        }
        public async Task ListPriorityQueryHandler_HandlesNegativeAndPositiveSearchTerms()
        {
            var command = new ListPriorityQuery {
                Priorities = "A-E", Terms = new string[] { "-+project", "@context" }
            };
            ListPriorityResponse result = await _handler.Handle(command, new CancellationToken());

            result.Tasks.Should().HaveCount(1);
            result.Tasks.First().Text.Should().Be("(D) This is lower @context");
        }
        public async Task ListPriorityQueryHandler_HandlesMultipleNegativeSearchTerms()
        {
            var command = new ListPriorityQuery {
                Priorities = "A-B", Terms = new string[] { "-+project", "-@context" }
            };
            ListPriorityResponse result = await _handler.Handle(command, new CancellationToken());

            result.Tasks.Should().HaveCount(2);
            result.Tasks.First().Text.Should().Be("(A) This is high priority");
        }
        public async Task ListPriorityQueryHandler_ReturnsTasksWithSearchTerms()
        {
            var command = new ListPriorityQuery {
                Priorities = "A", Terms = new string[] { "+project" }
            };
            ListPriorityResponse result = await _handler.Handle(command, new CancellationToken());

            result.Tasks.Should().HaveCount(1);
            result.Tasks.First().Text.Should().Be("(A) This is also a high priority +project @context");
        }
        public async Task ListPriorityQueryHandler_HandlesMultipleLowercasePriorities()
        {
            var command = new ListPriorityQuery {
                Priorities = "a-b", Terms = null
            };
            ListPriorityResponse result = await _handler.Handle(command, new CancellationToken());

            result.Tasks.Should().HaveCount(4);
            result.Tasks.First().Text.Should().Be("(A) This is high priority");
            result.Tasks.Last().Text.Should().Be("(B) This is secondary");
        }
        public async Task ListPriorityQueryHandler_WithoutPriority_ReturnsAllPrioritizedTasks(string priorities)
        {
            var command = new ListPriorityQuery {
                Priorities = priorities, Terms = null
            };
            ListPriorityResponse result = await _handler.Handle(command, new CancellationToken());

            result.Tasks.Should().HaveCount(7);
            result.Tasks.First().Text.Should().Be("(A) This is high priority");
            result.Tasks.Last().Text.Should().Be("(Z) Very low priority with +project");
        }