correction on build
continuous-integration/drone/push Build is failing Details

pull/44/head
Alexandre AGOSTINHO 2 years ago
parent 1049c8f6d9
commit da4121b729

@ -13,17 +13,13 @@ Console.WriteLine("Hello, World!\n\n");
Stub stub = new Stub(); Stub stub = new Stub();
List<Recipe> recipes = stub.LoadRecipes(); List<User> users = stub.ConstrucList();
List<RecipeCollection> recipeCollections = stub.LoadRecipeCollection(); RecipeCollection recipes = new RecipeCollection("all", stub.LoadRecipes().ToArray());
RecipeCollection? allRecipe = recipeCollections.Find(x => x.Description.Equals("All")); Console.WriteLine(recipes);
if (allRecipe == null) Console.WriteLine("\n---------------------------\n");
throw new ArgumentException("Load AllRecipe in stub: can't find 'All'.");
Manager manager = new Manager(allRecipe); recipes[]
Recipe? ret = SearcherRecipe.ResearchOn(allRecipe);
Console.WriteLine(ret);
// press any key to quit // press any key to quit
Console.ReadKey(); Console.ReadKey();

@ -15,24 +15,24 @@ namespace ConsoleApp
List<Recipe> stub = new List<Recipe>(); List<Recipe> stub = new List<Recipe>();
stub.AddRange(new[] stub.AddRange(new[]
{ {
new Recipe(), new Recipe(""),
new Recipe( new Recipe(
title: "Cookies"), title: "Cookies"),
new Recipe( new Recipe(
title: "Cookies", id: 23), title: "Cookies"),
new Recipe( new Recipe(
title: "Cookies au chocolat", id: null), title: "Cookies au chocolat"),
new Recipe( new Recipe(
title: "", id: null), title: ""),
new Recipe( new Recipe(
title: "", id: 24), title: ""),
new Recipe( new Recipe(
title: "Cookies", id: 24, title: "Cookies",
preparationSteps: new[]{ preparationSteps: new[]{
new PreparationStep(1) new PreparationStep(1)
}), }),
new Recipe( new Recipe(
title: "Cookies", id: 26, title: "Cookies",
preparationSteps: new[]{ preparationSteps: new[]{
new PreparationStep(1), new PreparationStep(1),
new PreparationStep(2, "Faire cuire.") new PreparationStep(2, "Faire cuire.")

@ -17,12 +17,14 @@ namespace Model_UnitTests
description: "test recipe", description: "test recipe",
recipes: new[] recipes: new[]
{ {
new Recipe(title: "Gateau à la crème", id: 1), new Recipe(title: "Gateau à la crème"),
new Recipe(title: "Gateau au chocolat", id: 2), new Recipe(title: "Gateau au chocolat"),
new Recipe(title: "Gateau aux cerises", id: 3) new Recipe(title: "Gateau aux cerises")
}); });
Assert.Equal(2, recipes.ResearchByName("chocolat").FirstOrDefault().Id); Recipe? search_result = recipes.ResearchByName("chocolat").FirstOrDefault();
Assert.NotNull(search_result);
Assert.Equal("Gateau au chocolat", search_result.Title);
} }
} }
} }

@ -7,22 +7,8 @@ namespace Model_UnitTests
[Fact] [Fact]
public void TestVoidConstructor() public void TestVoidConstructor()
{ {
Recipe r = new Recipe(id: 999); // id is given to avoid tests errors with the static atrribute 'idCreator'. Recipe r = new Recipe(""); // id is given to avoid tests errors with the static atrribute 'idCreator'.
Assert.NotNull(r.Title); Assert.NotNull(r.Title);
} }
[Theory]
[InlineData("Cookies", 23, "Cookies", 23)]
[InlineData("Cookies", 1, "Cookies", 1)]
[InlineData("No title.", 1, "", 1)]
public void TestConstructor(string expectedTitle, int expectedId, string title, int? id)
{
Recipe r = new Recipe(title, id);
Assert.NotNull(r.Title);
Assert.Equal(expectedId, r.Id);
Assert.Equal(expectedTitle, r.Title);
}
} }
} }

Loading…
Cancel
Save