Example #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());
        }
Example #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   ingredientsEquality  = this.GetIngredients() == newRecipe.GetIngredients();
         bool   instructionsEquality = this.GetInstructions() == newRecipe.GetInstructions();
         return(idEquality && nameEquality && ingredientsEquality && instructionsEquality);
     }
 }
        public void Update_UpdatesRecipeNameInDb_True()
        {
            string name         = "soup";
            string instructions = "heat up";
            Recipe testRecipe   = new Recipe(name, instructions);

            testRecipe.Save();

            string newName         = "burgers";
            string newInstructions = "fry";

            testRecipe.Update(newName, newInstructions);

            string resultName = testRecipe.GetName();

            Assert.Equal(resultName, "burgers");
        }
Example #4
0
 public override bool Equals(System.Object randomRecipe)
 {
     if (!(randomRecipe is Recipe))
     {
         return(false);
     }
     else
     {
         Recipe newRecipe            = (Recipe)randomRecipe;
         bool   idEquality           = (this.GetId() == newRecipe.GetId());
         bool   nameEquality         = (this.GetName() == newRecipe.GetName());
         bool   ingredientsEquality  = (this.GetIngredients() == newRecipe.GetIngredients());
         bool   instructionsEquality = (this.GetInstructions() == newRecipe.GetInstructions());
         bool   rateEquality         = (this.GetRate() == newRecipe.GetRate());
         bool   timeEquality         = (this.GetTime() == newRecipe.GetTime());
         return(idEquality && nameEquality && ingredientsEquality && instructionsEquality && rateEquality && timeEquality);
     }
 }
Example #5
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.GetIngredients() == newRecipe.GetIngredients());
         bool   instructionEquality = (this.GetInstructions() == newRecipe.GetInstructions());
         bool   cookTimeEquality    = (this.GetTime() == newRecipe.GetTime());
         bool   ratingEquality      = (this.GetRating() == newRecipe.GetRating());
         bool   urlEquality         = (this.GetUrl() == newRecipe.GetUrl());
         return(idEquality && nameEquality && ingredientEquality && instructionEquality && cookTimeEquality && ratingEquality && urlEquality);
     }
 }