Example #1
0
        public async Task CountBySearchAsyncShouldReturnCorrectCount()
        {
            var db = DbInfrastructure.GetDatabase();

            // 100 drinks with 3 categories
            await this.SeedData(db, 100, 3);

            var drinkService = new DrinkService(db);

            const string Search = "0";

            var actualCount = await drinkService.CountBySearchAsync(Search);

            var expectedCount = await db
                                .Drinks
                                .Where(d => d.Name.ToLower().Contains(Search.ToLower()))
                                .CountAsync();

            actualCount.Should().Be(expectedCount);
        }