Пример #1
0
 public static Criteria NameContains(string text)
 {
     return(CriteriaMother.Create(
                FiltersMother.CreateOne(
                    FilterMother.FromValues(new Dictionary <string, string>
     {
         { "field", "name" },
         { "operator", "CONTAINS" },
         { "value", text }
     })
                    ), Order.None()
                ));
 }
        public async Task ItShouldSearchAllExistingCoursesWithAnEmptyCriteria()
        {
            var existingCourse        = BackofficeCourseMother.Random();
            var anotherExistingCourse = BackofficeCourseMother.Random();

            var existingCourses = new List <BackofficeCourse>
            {
                existingCourse, anotherExistingCourse
            };

            await ElasticRepository.Save(existingCourse);

            await ElasticRepository.Save(anotherExistingCourse);

            await WaitFor(async() => (await ElasticRepository.SearchAll()).Any());

            Assert.Equal(existingCourses, (await ElasticRepository.Matching(CriteriaMother.Empty())).ToList());
        }