Esempio n. 1
0
        public void ListContextsQueryHandler_HandlesNullTerms()
        {
            var command = new ListContextsQuery {
                Terms = null
            };

            Assert.DoesNotThrowAsync(async() => await _handler.Handle(command, new CancellationToken()));
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
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");
        }
Esempio n. 4
0
        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);
            }
        }
Esempio n. 5
0
        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");
        }
Esempio n. 6
0
        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");
        }