// 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; }
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); }
public void RemoveRecipe(string recipeName) { Recipe my_recipe = new Recipe { RecipeName = recipeName }; context.Recipes.Remove(my_recipe); context.SaveChanges(); }
public void CardEnsureICanCreateRecipeInstance() { Recipe recipe = new Recipe(); Assert.IsNotNull(recipe); }