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

            Assert.DoesNotThrowAsync(async() => await _handler.Handle(command, new CancellationToken()));
        }
Example #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);
        }
Example #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");
        }
Example #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);
            }
        }
Example #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");
        }
Example #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");
        }