Ejemplo n.º 1
0
        public async void CountWhereTest()
        {
            var options = getOptions(nameof(CountWhereTest));

            await setup(options);

            var course = getCourse();

            using (var context = new CSAMSDbContext(options)) {
                // Initialize repository
                var repo = new CourseRepository(context);
                // Add actions
                await repo.Add(course);

                var csCourseCount = await repo.CountWhere(c => c.Code.ToLower().Contains("cs"));

                var ecCourseCount = await repo.CountWhere(c => c.Code.ToLower().Contains("ec"));

                // Add assertions
                Assert.NotEqual(csCourseCount, ecCourseCount);
                Assert.Equal(3, csCourseCount);
                Assert.Equal(1, ecCourseCount);
            }
        }