示例#1
0
        public void ListProjectsQueryHandler_HandlesNullTerms()
        {
            var command = new ListProjectsQuery {
                Terms = null
            };

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