Пример #1
0
    public void GetRecipes_ReturnsAllRecipesForIngredient_RecipeList()
    {
      //Arrange
      Ingredient testIngredient = new Ingredient("Dessert");
      testIngredient.Save();

      Recipe testRecipe1 = new Recipe("Chocolate Chip Cookies", "Melt butter, mix with sugar, eggs, flour, salt, baking soda, chocolate chips. Bake for 10 minutes", 5);
      testRecipe1.Save();

      Recipe testRecipe2 = new Recipe("Ceviche", "Put the tilapia in a medium bowl. Pour the lime juice over the fish and mix gently to combine.", 5);
      testRecipe2.Save();

      //Act
      testIngredient.AddRecipeToIngredientJoinTable(testRecipe1);
      testIngredient.AddRecipeToIngredientJoinTable(testRecipe2);

      List<Recipe> savedRecipes = testIngredient.GetRecipes();
      List<Recipe> testList = new List<Recipe> {testRecipe1, testRecipe2};

      //Assert
      CollectionAssert.AreEqual(testList, savedRecipes);
    }
Пример #2
0
    public void Delete_DeletesIngredientFromIngredientsAndJointTable_IngredientList()
    {
      //Arrange
      Recipe testRecipe = new Recipe("Chocolate Chip Cookies", "Melt butter, mix with sugar, eggs, flour, salt, baking soda, chocolate chips. Bake for 10 minutes", 5);
      testRecipe.Save();

      Ingredient testIngredient = new Ingredient("Dessert");
      testIngredient.Save();

      //Act
      testIngredient.AddRecipeToIngredientJoinTable(testRecipe);
      testIngredient.Delete();

      List<Ingredient> resultRecipeIngredients = testRecipe.GetIngredients();
      List<Ingredient> testRecipeIngredients = new List<Ingredient> {};

      //Assert
      CollectionAssert.AreEqual(testRecipeIngredients, resultRecipeIngredients);
    }