示例#1
0
        public async Task ListAllQueryHandler_ReturnsAllTasksWithoutBlanksWithoutSearchTerms()
        {
            var command = new ListAllQuery {
                Terms = new string[0]
            };
            ListAllResponse result = await _handler.Handle(command, new CancellationToken());

            result.Tasks.Should().HaveCount(9);
        }
示例#2
0
        public async Task ListAllQueryHandler_SortsCompletedTasksLast()
        {
            var command = new ListAllQuery {
                Terms = null
            };
            ListAllResponse result = await _handler.Handle(command, new CancellationToken());

            result.Tasks[6].Text.Should().Be("x This is complete @context");
        }
示例#3
0
        public async Task ListAllQueryHandler_ReturnsTasksWithSearchTerms()
        {
            var command = new ListAllQuery {
                Terms = new string[] { "+project" }
            };
            ListAllResponse result = await _handler.Handle(command, new CancellationToken());

            result.Tasks.Should().HaveCount(3);
            result.ShownTasks.Should().Be(2);
            result.ShownDone.Should().Be(1);
            result.TotalTasks.Should().Be(7);
            result.TotalDone.Should().Be(2);
        }
示例#4
0
        public async Task ListAllQueryHandler_HandlesNegativeAndPositiveSearchTerms()
        {
            var command = new ListAllQuery {
                Terms = new string[] { "-+project", "@context" }
            };
            ListAllResponse result = await _handler.Handle(command, new CancellationToken());

            result.Tasks.Should().HaveCount(2);
            result.ShownTasks.Should().Be(1);
            result.ShownDone.Should().Be(1);
            result.TotalTasks.Should().Be(7);
            result.TotalDone.Should().Be(2);
        }
示例#5
0
        public async Task ListAllQueryHandler_ReturnsTasksInPriorityOrder()
        {
            var command = new ListAllQuery {
                Terms = null
            };
            ListAllResponse result = await _handler.Handle(command, new CancellationToken());

            result.Tasks.First().Text.Should().Be("(A) This is high priority");
            result.Tasks.Last().Text.Should().Be("x Two +project");
            result.ShownTasks.Should().Be(7);
            result.ShownDone.Should().Be(2);
            result.TotalTasks.Should().Be(7);
            result.TotalDone.Should().Be(2);
        }
    public override object OnGet(ListAllResponse request)
    {
        APIClient c = VenueServiceHelper.CheckAndGetClient(request.APIKey,
                                                           VenueServiceHelper.Methods.ListDestinations);
        var response = new CodesResponse();

        if (request.Type == "counties")
        {
            response.Results = General.GetListOfCounties();
        }
        else if (request.Type == "destinations")
        {
            response.Results = General.GetListOfDestinations();
        }
        return(response);
    }