示例#1
0
        public async Task EditAsyncShouldEditDrink()
        {
            var db = DbInfrastructure.GetDatabase();

            var drinkService = new DrinkService(db);

            await drinkService.AddAsync(
                "Some name",
                "Stupid description",
                "The full description",
                2.23M,
                "Image URL",
                "Image TURL",
                false,
                true,
                56);

            var actualDrink = await db.Drinks.FirstAsync();

            await drinkService.EditAsync(
                actualDrink.Id,
                Name,
                Description,
                FullDescription,
                Price,
                ImageUrl,
                ImageThumbnailUrl,
                true,
                false,
                CategoryId);

            actualDrink = await db.Drinks.FirstAsync();

            actualDrink.Name.Should().Be(Name);
            actualDrink.Description.Should().Be(Description);
            actualDrink.FullDescription.Should().Be(FullDescription);
            actualDrink.Price.Should().Be(Price);
            actualDrink.ImageUrl.Should().Be(ImageUrl);
            actualDrink.ImageThumbnailUrl.Should().Be(ImageThumbnailUrl);
            actualDrink.IsPreferred.Should().Be(true);
            actualDrink.IsInStock.Should().Be(false);
            actualDrink.CategoryId.Should().Be(CategoryId);
        }