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

            const int AlcoholicDrinks = 150;

            var alcoholicCategory = new Category
            {
                Name = "Alcoholic"
            };

            var nonAlcoholicCategory = new Category
            {
                Name = "Non-Alcoholic"
            };

            await db.AddRangeAsync(alcoholicCategory, nonAlcoholicCategory);

            await db.SaveChangesAsync();

            await this.SeedDataByCategory(db, AlcoholicDrinks, alcoholicCategory.Id);

            await this.SeedDataByCategory(db, 1234, nonAlcoholicCategory.Id);

            var drinkService = new DrinkService(db);

            var count = await drinkService.AlcoholicCountAsync();

            count.Should().Be(AlcoholicDrinks);
        }