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());
        }
        public async Task ItShouldFilterByCriteria()
        {
            var dddInPhpCourse      = BackofficeCourseMother.WithName("DDD en PHP");
            var dddInCSharpCourse   = BackofficeCourseMother.WithName("DDD en C#");
            var exprimiendoIntellij = BackofficeCourseMother.WithName("Exprimiendo Intellij");

            var courses = new List <BackofficeCourse>()
            {
                dddInPhpCourse, dddInCSharpCourse
            };

            var nameContainsDddCriteria = BackofficeCourseCriteriaMother.NameContains("DDD");

            await ElasticRepository.Save(dddInPhpCourse);

            await ElasticRepository.Save(dddInCSharpCourse);

            await ElasticRepository.Save(exprimiendoIntellij);

            await WaitFor(async() => (await ElasticRepository.Matching(nameContainsDddCriteria)).Any());

            Assert.Equal(courses, (await ElasticRepository.Matching(nameContainsDddCriteria)).ToList());
        }
 public void ItShouldSaveAValidCourse()
 {
     ElasticRepository.Save(BackofficeCourseMother.Random());
 }