示例#1
0
        public async Task SearchAsyncByDescriptorShouldSucceed()
        {
            var items1 = await _mockRepo.SearchAsync(x => x.MatchAll());

            var items2 = await _mockRepo.SearchAsync(x => x
                                                     .Query(q => q
                                                            .Term(t => t
                                                                  .Field(f => f.IsActive)
                                                                  .Value(false)
                                                                  )
                                                            )
                                                     );

            var items3 = await _mockRepo.SearchAsync(x => x
                                                     .Query(q => q
                                                            .Term(t => t
                                                                  .Field(f => f.Name)
                                                                  .Value("xyz")
                                                                  )
                                                            )
                                                     );

            Assert.NotEmpty(items1);
            Assert.Equal(2, items1.Count);

            Assert.NotEmpty(items2);
            Assert.Equal(1, items2.Count);

            Assert.NotNull(items3);
            Assert.Empty(items3);
        }