diff --git a/MCTG/MCTGApp/Program.cs b/MCTG/MCTGApp/Program.cs index 9998a9b..9196a9a 100644 --- a/MCTG/MCTGApp/Program.cs +++ b/MCTG/MCTGApp/Program.cs @@ -1,6 +1,6 @@ // See https://aka.ms/new-console-template for more information -using Model; +using MCTGLib; Console.WriteLine("Hello, World!\n"); diff --git a/MCTG/MCTGLib/BaseItem.cs b/MCTG/MCTGLib/BaseItem.cs index 8d8cd81..9d60520 100644 --- a/MCTG/MCTGLib/BaseItem.cs +++ b/MCTG/MCTGLib/BaseItem.cs @@ -3,7 +3,7 @@ using System; using System.ComponentModel; using System.Diagnostics.CodeAnalysis; -namespace Model +namespace MCTGLib { /// /// Define the base structure of any Items.
diff --git a/MCTG/MCTGLib/IDisplayable.cs b/MCTG/MCTGLib/IDisplayable.cs index fed294c..5de9319 100644 --- a/MCTG/MCTGLib/IDisplayable.cs +++ b/MCTG/MCTGLib/IDisplayable.cs @@ -1,4 +1,4 @@ -namespace Model +namespace MCTGLib { /// /// Define an Item that can be displayed. diff --git a/MCTG/MCTGLib/Recipe.cs b/MCTG/MCTGLib/Recipe.cs index f5cb00d..7e55030 100644 --- a/MCTG/MCTGLib/Recipe.cs +++ b/MCTG/MCTGLib/Recipe.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; -namespace Model +namespace MCTGLib { /// /// A Recipe is a description of step and maybe some techniques, with an ingredient list to make a meal.
diff --git a/MCTG/MCTGLib/RecipeCollection.cs b/MCTG/MCTGLib/RecipeCollection.cs index 0611a0f..4e799d3 100644 --- a/MCTG/MCTGLib/RecipeCollection.cs +++ b/MCTG/MCTGLib/RecipeCollection.cs @@ -3,7 +3,7 @@ using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; -namespace Model +namespace MCTGLib { /// /// A Recipe collection is a group of recipe.
@@ -15,7 +15,7 @@ namespace Model private const int CAT_ITEM = 2; // the first number of the item full id : the item category. private static uint _idCreator = 0; // stand for the creation of a new id. It is incremented each time a new Recipe is instantiated. - private ICollection _recipes = new List(); // main composent of this class. + private readonly ICollection _recipes = new List(); // main composent of this class. #endregion diff --git a/MCTG/Tests/MCTGLib_UnitTests/MCTGLib_UnitTests.csproj b/MCTG/Tests/MCTGLib_UnitTests/MCTGLib_UnitTests.csproj index 42ff44d..afc37b6 100644 --- a/MCTG/Tests/MCTGLib_UnitTests/MCTGLib_UnitTests.csproj +++ b/MCTG/Tests/MCTGLib_UnitTests/MCTGLib_UnitTests.csproj @@ -22,4 +22,8 @@ + + + + diff --git a/MCTG/Tests/MCTGLib_UnitTests/Recipe_UT.cs b/MCTG/Tests/MCTGLib_UnitTests/Recipe_UT.cs new file mode 100644 index 0000000..3196733 --- /dev/null +++ b/MCTG/Tests/MCTGLib_UnitTests/Recipe_UT.cs @@ -0,0 +1,34 @@ +using MCTGLib; + +namespace MCTGLib_UnitTests +{ + public class Recipe_UT + { + [Fact] + public void TestConstructorNotNull() + { + Recipe r1 = new Recipe(); + Assert.NotNull(r1); + } + + [Fact] + public void TestConstructorWithValidDefaults() + { + Recipe r1 = new Recipe(); + Assert.Equal("Recipe n10", r1.Title); + Assert.Equal("A recipe.", r1.Description); + } + + [Fact] + public void TestComputeId() + { + List lr = new List(); + for (int i = 0; i < 11; i++) + lr.Add(new Recipe()); + + Assert.Equal((uint)18, lr.ElementAt(8).Id); + Assert.Equal((uint)19, lr.ElementAt(9).Id); + Assert.Equal((uint)110, lr.ElementAt(10).Id); + } + } +} \ No newline at end of file diff --git a/MCTG/Tests/MCTGLib_UnitTests/UnitTest1.cs b/MCTG/Tests/MCTGLib_UnitTests/UnitTest1.cs deleted file mode 100644 index 4d22b68..0000000 --- a/MCTG/Tests/MCTGLib_UnitTests/UnitTest1.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace MCTGLib_UnitTests -{ - public class UnitTest1 - { - [Fact] - public void Test1() - { - - } - } -} \ No newline at end of file