示例#1
0
        // create a recipe
        public Recipe CreateRecipe(string recipeName, ApplicationUser owner)
        {
            Recipe my_recipe = new Recipe { RecipeName = recipeName, RecipeCreator = owner, RecipeIngredients = new List<Ingredient>() };
            context.Recipes.Add(my_recipe);
            context.SaveChanges(); // This saves something to the Database

            return my_recipe;
        }
示例#2
0
        public void RecipeEnsureRecipePropertiesWork()
        {
            var tom = new ApplicationUser();

            // Object Initializer syntax
            Recipe recipe = new Recipe { RecipeName = "Soup", RecipeId = 4, RecipeCreator = tom,
                RecipeDescription = "recipe", RecipeDirections = "stir"};

            Assert.AreEqual("Soup", recipe.RecipeName);
            Assert.AreEqual(4, recipe.RecipeId);
            Assert.AreEqual(tom, recipe.RecipeCreator);
            Assert.AreEqual("stir", recipe.RecipeDirections);
        }
示例#3
0
 public void RemoveRecipe(string recipeName)
 {
     Recipe my_recipe = new Recipe { RecipeName = recipeName };
     context.Recipes.Remove(my_recipe);
     context.SaveChanges();
 }
示例#4
0
 public void CardEnsureICanCreateRecipeInstance()
 {
     Recipe recipe = new Recipe();
     Assert.IsNotNull(recipe);
 }