diff --git a/MCTG/MCTGApp/MCTGApp.csproj b/MCTG/MCTGApp/ConsoleApp.csproj similarity index 99% rename from MCTG/MCTGApp/MCTGApp.csproj rename to MCTG/MCTGApp/ConsoleApp.csproj index f184388..6dd3df4 100644 --- a/MCTG/MCTGApp/MCTGApp.csproj +++ b/MCTG/MCTGApp/ConsoleApp.csproj @@ -7,8 +7,8 @@ enable - - + + diff --git a/MCTG/MCTGApp/Program.cs b/MCTG/MCTGApp/Program.cs index aa01b39..c677863 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 MCTGLib; +using Model; Console.WriteLine("Hello, World!\n"); diff --git a/MCTG/MCTGLib/MCTGLib.csproj b/MCTG/MCTGLib/Model.csproj similarity index 100% rename from MCTG/MCTGLib/MCTGLib.csproj rename to MCTG/MCTGLib/Model.csproj diff --git a/MCTG/MCTGLib/PreparationStep.cs b/MCTG/MCTGLib/PreparationStep.cs index 13a7d7a..ad549b6 100644 --- a/MCTG/MCTGLib/PreparationStep.cs +++ b/MCTG/MCTGLib/PreparationStep.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace MCTGLib +namespace Model { public class PreparationStep { diff --git a/MCTG/MCTGLib/Recipe.cs b/MCTG/MCTGLib/Recipe.cs index ebbdac6..eca21b2 100644 --- a/MCTG/MCTGLib/Recipe.cs +++ b/MCTG/MCTGLib/Recipe.cs @@ -1,18 +1,18 @@ -using System; -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Runtime.CompilerServices; -namespace MCTGLib -{ - - public class Recipe : IEquatable - { - private static int idCreator = 0; - - public int Id { get; init; } - public string Description { get; init; } - public string Title { get; set; } - +namespace Model +{ + + public class Recipe : IEquatable + { + private static int idCreator = 0; + + public int Id { get; init; } + public string Description { get; init; } + public string Title { get; set; } + public Recipe(string title, string description = "No Description.") { Id = idCreator++; @@ -31,5 +31,5 @@ namespace MCTGLib { return Id.GetHashCode(); } - } -} + } +} diff --git a/MCTG/MCTGLib/RecipeCollection.cs b/MCTG/MCTGLib/RecipeCollection.cs index 95b5ff5..de3503e 100644 --- a/MCTG/MCTGLib/RecipeCollection.cs +++ b/MCTG/MCTGLib/RecipeCollection.cs @@ -1,17 +1,17 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; - -namespace MCTGLib -{ - - public class RecipeCollection : IList, IEquatable +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; + +namespace Model +{ + + public class RecipeCollection : IList, IEquatable { - #region Attributes + #region Attributes private List _recipes; - #endregion - + #endregion + #region Properties public string Description { get; set; } @@ -27,8 +27,8 @@ namespace MCTGLib { _recipes = new List(); Description = description; - } - + } + public RecipeCollection(params Recipe[] recipes) { _recipes = new List(recipes); @@ -103,5 +103,5 @@ namespace MCTGLib return Description.GetHashCode() + _recipes.GetHashCode(); } #endregion - } -} + } +} diff --git a/MCTG/Tests/MCTGLib_UnitTests/MCTGLib_UnitTests.csproj b/MCTG/Tests/MCTGLib_UnitTests/Model_UnitTests.csproj similarity index 100% rename from MCTG/Tests/MCTGLib_UnitTests/MCTGLib_UnitTests.csproj rename to MCTG/Tests/MCTGLib_UnitTests/Model_UnitTests.csproj diff --git a/MCTG/Tests/MCTGLib_UnitTests/Recipe_UT.cs b/MCTG/Tests/MCTGLib_UnitTests/Recipe_UT.cs index 3196733..40d8504 100644 --- a/MCTG/Tests/MCTGLib_UnitTests/Recipe_UT.cs +++ b/MCTG/Tests/MCTGLib_UnitTests/Recipe_UT.cs @@ -1,34 +1,32 @@ -using MCTGLib; +using Model; -namespace MCTGLib_UnitTests +namespace Model_UnitTests { public class Recipe_UT { [Fact] public void TestConstructorNotNull() { - Recipe r1 = new Recipe(); + Recipe r1 = new Recipe("R1"); Assert.NotNull(r1); } [Fact] public void TestConstructorWithValidDefaults() { - Recipe r1 = new Recipe(); - Assert.Equal("Recipe n10", r1.Title); - Assert.Equal("A recipe.", r1.Description); + Recipe r2 = new Recipe("Recipe n2"); + Assert.Equal("Recipe n2", r2.Title); + Assert.Equal("No Description.", r2.Description); } [Fact] - public void TestComputeId() + public void TestRecipeId() { - List lr = new List(); - for (int i = 0; i < 11; i++) - lr.Add(new Recipe()); + Recipe r3 = new Recipe("R3"); + Recipe r4 = new Recipe("R4"); - Assert.Equal((uint)18, lr.ElementAt(8).Id); - Assert.Equal((uint)19, lr.ElementAt(9).Id); - Assert.Equal((uint)110, lr.ElementAt(10).Id); + Assert.Equal(2, r3.Id); + Assert.Equal(3, r4.Id); } } -} \ No newline at end of file +}