public void ListProjectsQueryHandler_HandlesNullTerms() { var command = new ListProjectsQuery { Terms = null }; Assert.DoesNotThrowAsync(async() => await _handler.Handle(command, new CancellationToken())); }
public async Task ListProjectsQueryHandler_HandlesMultipleNegativeSearchTerms() { var command = new ListProjectsQuery { Terms = new string[] { "-+project1", "-+project2" } }; string[] result = await _handler.Handle(command, new CancellationToken()); result.Length.Should().Be(0); }
public async Task ListProjectsQueryHandler_ReturnsContextsWithSearchTerms() { var command = new ListProjectsQuery { Terms = new string[] { "+project1" } }; string[] result = await _handler.Handle(command, new CancellationToken()); result.Length.Should().Be(1); result[0].Should().Be("+project1"); }
private async Task ListProjects(string[] terms) { var query = new ListProjectsQuery { Terms = terms }; var result = await Mediator.Send(query); foreach (string project in result) { Console.WriteLine(project); } }
public async Task ListProjectsQueryHandler_OrsTheQueryForMultipleSearchTerms() { var command = new ListProjectsQuery { Terms = new string[] { "+project1", "+project2" } }; string[] result = await _handler.Handle(command, new CancellationToken()); result.Length.Should().Be(2); result[0].Should().Be("+project1"); result[1].Should().Be("+project2"); }
public async Task ListProjectsQueryHandler_ReturnsContextsSorted() { var command = new ListProjectsQuery { Terms = null }; string[] result = await _handler.Handle(command, new CancellationToken()); result.Length.Should().Be(2); result[0].Should().Be("+project1"); result[1].Should().Be("+project2"); }