コード例 #1
0
        public async Task ReturnsFalse()
        {
            string ingredientName = "Ingredient";
            string wrongName      = "se taq";
            byte   type           = 1;

            var options = TestUtilities.GetOptions(nameof(ReturnsFalse));

            using (var arrangeContext = new CocktailDatabaseContext(options))
            {
                arrangeContext.Ingredients.Add(new Ingredient()
                {
                    Name = ingredientName, Primary = type
                });
                arrangeContext.SaveChanges();
            }

            using (var assertContext = new CocktailDatabaseContext(options))
            {
                var sut  = new IngredientService(assertContext);
                var resu = await sut.CheckIfIngredientExistsAsync(wrongName, type);

                Assert.IsFalse(resu);
            }
        }