public void ListContextsQueryHandler_HandlesNullTerms() { var command = new ListContextsQuery { Terms = null }; Assert.DoesNotThrowAsync(async() => await _handler.Handle(command, new CancellationToken())); }
public async Task ListContextsQueryHandler_HandlesMultipleNegativeSearchTerms() { var command = new ListContextsQuery { Terms = new string[] { "-@context1", "-@context2" } }; string[] result = await _handler.Handle(command, new CancellationToken()); result.Length.Should().Be(0); }
public async Task ListContextsQueryHandler_ReturnsContextsWithSearchTerms() { var command = new ListContextsQuery { Terms = new string[] { "@context1" } }; string[] result = await _handler.Handle(command, new CancellationToken()); result.Length.Should().Be(1); result[0].Should().Be("@context1"); }
private async Task ListContexts(string[] terms) { var query = new ListContextsQuery { Terms = terms }; var result = await Mediator.Send(query); foreach (string context in result) { Console.WriteLine(context); } }
public async Task ListContextsQueryHandler_OrsTheQueryForMultipleSearchTerms() { var command = new ListContextsQuery { Terms = new string[] { "@context1", "@context2" } }; string[] result = await _handler.Handle(command, new CancellationToken()); result.Length.Should().Be(2); result[0].Should().Be("@context1"); result[1].Should().Be("@context2"); }
public async Task ListContextsQueryHandler_ReturnsContextsSorted() { var command = new ListContextsQuery { Terms = null }; string[] result = await _handler.Handle(command, new CancellationToken()); result.Length.Should().Be(2); result[0].Should().Be("@context1"); result[1].Should().Be("@context2"); }