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

            var drinkService = new DrinkService(db);

            const int Drinks = 90;

            // 90 preffered drinks with 3 categories
            await this.SeedData(db, Drinks, 3, true);

            var drinks = await drinkService.PreferredAsync();

            drinks
            .Should()
            .HaveCount(Drinks);

            drinks
            .Should()
            .BeInAscendingOrder(d => d.Name);

            foreach (var drink in drinks)
            {
                var drinkFromDb = await db
                                  .Drinks
                                  .FindAsync(drink.Id);

                drinkFromDb.IsPreferred.Should().BeTrue();
            }
        }