From b2e6217d103eb7b49c99969d1efd09797007e456 Mon Sep 17 00:00:00 2001 From: Alexandre Agostinho Date: Sun, 7 May 2023 01:12:16 +0200 Subject: [PATCH] :white_check_mark: make sure test work + add a test for RecipeCollection.ResearchByName --- .../Model_UnitTests/RecipeCollection_UT.cs | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 MCTG/Tests/Model_UnitTests/RecipeCollection_UT.cs diff --git a/MCTG/Tests/Model_UnitTests/RecipeCollection_UT.cs b/MCTG/Tests/Model_UnitTests/RecipeCollection_UT.cs new file mode 100644 index 0000000..36008b1 --- /dev/null +++ b/MCTG/Tests/Model_UnitTests/RecipeCollection_UT.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +using Model; + +namespace Model_UnitTests +{ + public class RecipeCollection_UT + { + [Fact] + public void TestResearchByName() + { + RecipeCollection recipes = new RecipeCollection( + description: "test recipe", + recipes: new[] + { + new Recipe(title: "Gateau à la crème", id: 1), + new Recipe(title: "Gateau au chocolat", id: 2), + new Recipe(title: "Gateau aux cerises", id: 3) + }); + + Assert.Equal(2, recipes.ResearchByName("chocolat").FirstOrDefault().Id); + } + } +}