Ejemplo n.º 1
0
        public void Test_Update_UpdateRecipe()
        {
            string url         = "www.epicodus.com";
            string name        = "Spaghetti";
            Recipe testRecipe1 = new Recipe(name, "Noodles, Sauce", "Boil noodles", "20 Minutes", 5, url);

            testRecipe1.Save();

            string newName         = "Chicken Tandoori";
            string newIngredients  = "Chicken,Onions,Tomato";
            string newInstructions = "Roast Chicken";
            string newCookTime     = "30 minutes";
            int    newRating       = 5;
            string newUrl          = "www.google.com";

            testRecipe1.Update(newName, newIngredients, newInstructions, newCookTime, newRating, newUrl);
            Recipe actualResult = Recipe.GetAll()[0];

            Assert.Equal(newName, actualResult.GetName());
            Assert.Equal(newIngredients, actualResult.GetIngredients());
            Assert.Equal(newInstructions, actualResult.GetInstructions());
            Assert.Equal(newCookTime, actualResult.GetTime());
            Assert.Equal(newRating, actualResult.GetRating());
            Assert.Equal(newUrl, actualResult.GetUrl());
        }
Ejemplo n.º 2
0
 public override bool Equals(System.Object otherRecipe)
 {
     if (!(otherRecipe is Recipe))
     {
         return(false);
     }
     else
     {
         Recipe newRecipe           = (Recipe)otherRecipe;
         bool   idEquality          = (this.GetId() == newRecipe.GetId());
         bool   nameEquality        = (this.GetName() == newRecipe.GetName());
         bool   ingredientEquality  = (this.GetIngredient() == newRecipe.GetIngredient());
         bool   instructionEquality = (this.GetInstruction() == newRecipe.GetInstruction());
         bool   ratingEquality      = (this.GetRating() == newRecipe.GetRating());
         return(idEquality && nameEquality && ingredientEquality && instructionEquality && ratingEquality);
     }
 }