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

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

@ -17,12 +17,14 @@ namespace Model_UnitTests
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)
new Recipe(title: "Gateau à la crème"),
new Recipe(title: "Gateau au chocolat"),
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]
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);
}
[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