🩹 fix merge conflicts - update projects naming
continuous-integration/drone/push Build is failing Details

pull/35/head^2
Alexandre AGOSTINHO 2 years ago
commit e75734c527

@ -14,28 +14,34 @@ steps:
path: /docs
commands:
- cd MCTG/
- dotnet restore SAE-2.01.sln
- dotnet build SAE-2.01.sln -c Release --no-restore
- dotnet publish SAE-2.01.sln -c Release --no-restore -o CI_PROJECT_DIR/build/release
- dotnet restore ./ConsoleApp/ConsoleApp.csproj
- dotnet restore ./Model/Model.csproj
- dotnet restore ./Tests/Model_UnitTests/Model_UnitTests.csproj
- dotnet build SAE-2.01.sln -c CI --no-restore
- dotnet publish SAE-2.01.sln -c CI --no-restore -o CI_PROJECT_DIR/build/release
- name: tests
image: mcr.microsoft.com/dotnet/sdk:7.0
commands:
- cd MCTG/
- dotnet restore SAE-2.01.sln
- dotnet test SAE-2.01.sln --no-restore
depends_on: [build]
- dotnet restore ./ConsoleApp/ConsoleApp.csproj
- dotnet restore ./Model/Model.csproj
- dotnet restore ./Tests/Model_UnitTests/Model_UnitTests.csproj
- dotnet test SAE-2.01.sln -c CI --no-restore
depends_on: [ build ]
- name: code-analysis
image: hub.codefirst.iut.uca.fr/marc.chevaldonne/codefirst-dronesonarplugin-dotnet7
commands:
- cd MCTG/
- dotnet restore SAE-2.01.sln
- dotnet restore ./ConsoleApp/ConsoleApp.csproj
- dotnet restore ./Model/Model.csproj
- dotnet restore ./Tests/Model_UnitTests/Model_UnitTests.csproj
- dotnet sonarscanner begin /k:SAE-2.01 /d:sonar.host.url=$${PLUGIN_SONAR_HOST} /d:sonar.coverageReportPaths="coveragereport/SonarQube.xml" /d:sonar.coverage.exclusions="Tests/**" /d:sonar.login=$${PLUGIN_SONAR_TOKEN}
- dotnet build SAE-2.01.sln -c Release --no-restore
- dotnet test SAE-2.01.sln --logger trx --no-restore /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura --collect "XPlat Code Coverage"
- dotnet build SAE-2.01.sln -c CI --no-restore
- dotnet test SAE-2.01.sln -c CI --logger trx --no-restore /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura --collect "XPlat Code Coverage"
- reportgenerator -reports:"**/coverage.cobertura.xml" -reporttypes:SonarQube -targetdir:"coveragereport"
- dotnet publish SAE-2.01.sln -c Release --no-restore -o CI_PROJECT_DIR/build/release
- dotnet publish SAE-2.01.sln -c CI --no-restore -o CI_PROJECT_DIR/build/release
- dotnet sonarscanner end /d:sonar.login=$${PLUGIN_SONAR_TOKEN}
secrets: [ SECRET_SONAR_LOGIN ]
settings:

3
.gitignore vendored

@ -4,6 +4,9 @@
##
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
# User-spacific editor config
.editorconfig
# User-specific files
*.rsuser
*.suo

@ -7,8 +7,8 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\MCTGLib\Model.csproj" />
<ItemGroup>
<ProjectReference Include="..\Model\Model.csproj" />
</ItemGroup>
</Project>

@ -0,0 +1,21 @@
// See https://aka.ms/new-console-template for more information
using ConsoleApp;
using Model;
Console.WriteLine("Hello, World!\n\n");
// TESTS:
Stub stub = new Stub();
List<Recipe> recipes = stub.LoadRecipes();
List<RecipeCollection> recipeCollections = stub.LoadRecipeCollection();
foreach (Recipe r in recipes)
Console.WriteLine(r);
foreach (RecipeCollection r in recipeCollections)
Console.WriteLine(r);

@ -0,0 +1,60 @@
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp
{
internal struct Stub
{
public List<Recipe> LoadRecipes()
{
List<Recipe> stub = new List<Recipe>();
stub.AddRange(new[]
{
new Recipe(),
new Recipe("Cookies"),
new Recipe("Cookies", 23),
new Recipe("Cookies", null),
new Recipe("", null),
new Recipe("", 24),
new Recipe("Cookies", 24,
new PreparationStep(1)),
new Recipe("Cookies", 26,
new PreparationStep(1),
new PreparationStep(2, "Faire cuire."))
});
return stub;
}
public List<RecipeCollection> LoadRecipeCollection()
{
List<RecipeCollection> stub = new List<RecipeCollection>();
stub.AddRange(new[]
{
new RecipeCollection("All", LoadRecipes().ToArray()),
new RecipeCollection("Starters", LoadRecipes().FindAll(x => x.Id.Equals(23)).ToArray()),
new RecipeCollection("Dishies", LoadRecipes().FindAll(x => x.Id.Equals(24)).ToArray()),
new RecipeCollection("Desserts", LoadRecipes().FindAll(x => x.Id.Equals(26)).ToArray()),
});
return stub;
}
public List<User> ConstrucList()
{
List<User> Users = new List<User>();
User Roger = new User("Roger", "Rabbit", "carotte@mail.fr");
User Dylan = new User("d", "r", "dr@mail.fr");
User Val = new User("V", "entin", "Valentin@mail.fr");
Users.Add(Roger);
Users.Add(Dylan);
Users.Add(Val);
return Users;
}
}
}

@ -1,21 +0,0 @@
// See https://aka.ms/new-console-template for more information
using System.Runtime.InteropServices;
using MCTGLib;
Console.WriteLine("Hello, World!");
Stub stub = new Stub();
List<User> users = stub.ConstrucList();
foreach (User user in users)
{
try
{
Console.WriteLine(user.Name);
Console.WriteLine(user.Priorities[0].ToString());
} catch (ArgumentException erreurNomVide)
{
Console.WriteLine(erreurNomVide.Message);
}
}

@ -1,12 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Model
{
public class PasswordManager : IPasswordManager
{
}
}

@ -1,27 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
namespace MCTGLib
{
public class Stub
{
public List<User> ConstrucList()
{
List<User> Users = new List<User>();
User Roger = new User("Roger", "Rabbit", "carotte@mail.fr");
User Dylan = new User("d", "r", "dr@mail.fr");
User Val = new User("V", "entin", "Valentin@mail.fr");
Users.Add(Roger);
Users.Add(Dylan);
Users.Add(Val);
return Users;
}
}
}

@ -0,0 +1,80 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Model
{
/// <summary>
/// Define a step of the preparation of a recipe.
/// </summary>
public class PreparationStep : IEquatable<PreparationStep>
{
#region Attributes
private string _description = "";
#endregion
#region Properties
/// <summary>
/// The order of this step in the preparation of the meal.
/// </summary>
public int Order { get; init; }
/// <summary>
/// The description of the task the user need to do for this step of the preparation. <br/>
/// Set to "No description." when the value passed is null, empty or contain white spaces.
/// </summary>
public string Description
{
get => _description;
private set
{
if (string.IsNullOrWhiteSpace(value))
_description = "No description.";
else
_description = value;
}
}
#endregion
#region Constructors
/// <summary>
/// Construct a new step of preparation.
/// </summary>
/// <param name="order">The number of the order in preparation</param>
/// <param name="description">The description of the task</param>
public PreparationStep(int order, string description = "")
{
Order = order;
Description = description;
}
#endregion
#region Methods
public virtual bool Equals(PreparationStep? other)
{
if (other == null) return false;
if (other == this) return true;
return Order.Equals(other.Order) && Description.Equals(other.Description);
}
public override bool Equals(object? obj)
{
var item = obj as PreparationStep;
if (item == null) return false;
return Equals(obj);
}
public override int GetHashCode()
{
return Order.GetHashCode() + Description.GetHashCode();
}
public override string ToString()
{
return $"{Order}- {Description}";
}
#endregion
}
}

@ -0,0 +1,101 @@
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Security.Cryptography;
using System.Text;
namespace Model
{
/// <summary>
/// Define a Recipe for the preparation of a meal.
/// </summary>
public class Recipe : IEquatable<Recipe>
{
#region Attributes
private string _title = "";
#endregion
#region Properties
/// <summary>
/// The ID of the recipe - allows you to compare and/or get this item in an easier way.
/// </summary>
public int Id { get; init; }
/// <summary>
/// The Title of the recipe. <br/>
/// Set to "No title." when the value passed is null, empty or contain white spaces.
/// </summary>
public string Title
{
get => _title;
set
{
if (string.IsNullOrWhiteSpace(value))
_title = "No title.";
else
_title = value;
}
}
/// <summary>
/// The steps of the preparation. See: <see cref="PreparationStep"/>.
/// </summary>
public List<PreparationStep> PreparationSteps { get; set; }
#endregion
#region Constructors
/// <summary>
/// Construct a new recipe.
/// </summary>
/// <param name="title">The title of the recipe</param>
/// <param name="id">The id of the recipe. If not given, get a new id.</param>
/// <param name="preparationSteps">The steps of the preparation of the meal</param>
public Recipe(string title = "", int? id = null,
params PreparationStep[] preparationSteps)
{
Title = title;
PreparationSteps = new List<PreparationStep>(preparationSteps);
if (id == null)
{
var randomGenerator = RandomNumberGenerator.Create();
byte[] data = new byte[16];
randomGenerator.GetBytes(data);
Id = Math.Abs(BitConverter.ToInt16(data));
}
else Id = (int)id;
}
#endregion
#region Methods
public virtual bool Equals(Recipe? other)
{
if (other == null) return false;
if (other == this) return true;
return Title.Equals(other.Title) && PreparationSteps.Equals(other.PreparationSteps);
}
public override bool Equals(object? obj)
{
var item = obj as Recipe;
if (item == null) return false;
return Equals(obj);
}
public override int GetHashCode()
{
return Id.GetHashCode();
}
public override string ToString()
{
StringBuilder sb = new StringBuilder($"[Recipe n°{Id}] - {Title}\n");
foreach (PreparationStep ps in PreparationSteps)
{
sb.AppendFormat("\t* {0}\n", ps.ToString());
}
return sb.ToString();
}
#endregion
}
}

@ -0,0 +1,154 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
namespace Model
{
/// <summary>
/// Define a collection of <see cref="Recipe"/>.
/// <br/>This class implement <see cref="IList"/> and <see cref="IEquatable{T}"/>.
/// </summary>
public class RecipeCollection : IList<Recipe>, IEquatable<RecipeCollection>
{
#region Attributes
private readonly List<Recipe> _recipes;
private string _description = "";
#endregion
#region Properties
/// <summary>
/// A short description of what this collection contain. <br/>
/// Set to "No description." when the value passed is null, empty or contain white spaces.
/// </summary>
public string Description
{
get => _description;
set
{
if (string.IsNullOrWhiteSpace(value))
_description = "No description.";
else
_description = value;
}
}
#region IList Prperties
public int Count => _recipes.Count;
public bool IsReadOnly => false;
public Recipe this[int index] { get => _recipes[index]; set => _recipes[index] = value; }
#endregion
#endregion
#region Constructors
/// <summary>
/// Construct a new collection of _recipes.
/// </summary>
/// <param name="description">A short description of what this list will contain</param>
/// <param name="recipes">Recipes to add in this new collection</param>
public RecipeCollection(string description, params Recipe[] recipes)
{
_recipes = new List<Recipe>(recipes);
Description = description;
}
#endregion
#region Methods
/// <summary>
/// Find a recipe in this list by giving the id.
/// </summary>
/// <param name="id">The id of the list we are looking for</param>
/// <returns>The recipe of the id given</returns>
/// <exception cref="ArgumentException"/>
public Recipe? GetRecipeById(int id)
{
Recipe? recipe = _recipes.Find(r => r.Id == id);
if (recipe == null) throw new ArgumentException("No _recipes match the given id.");
return recipe;
}
#region IList Methods
public int IndexOf(Recipe item)
{
return _recipes.IndexOf(item);
}
public void Insert(int index, Recipe item)
{
_recipes.Insert(index, item);
}
public void RemoveAt(int index)
{
_recipes.RemoveAt(index);
}
public void Add(Recipe item)
{
_recipes.Add(item);
}
public void Clear()
{
_recipes.Clear();
}
public bool Contains(Recipe item)
{
return _recipes.Contains(item);
}
public void CopyTo(Recipe[] array, int arrayIndex)
{
_recipes.CopyTo(array, arrayIndex);
}
public bool Remove(Recipe item)
{
return _recipes.Remove(item);
}
public IEnumerator<Recipe> GetEnumerator()
{
return _recipes.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return _recipes.GetEnumerator();
}
#endregion
public virtual bool Equals(RecipeCollection? other)
{
if (other == null) return false;
if (other == this) return true;
return _description.Equals(other.Description) && _recipes.Equals(other._recipes);
}
public override bool Equals(object? obj)
{
var item = obj as RecipeCollection;
if (item == null) return false;
return Equals(obj);
}
public override int GetHashCode()
{
return _recipes.GetHashCode();
}
public override string ToString()
{
StringBuilder sb = new StringBuilder($"[RecipeCollection] - {Description}:\n");
foreach (Recipe r in _recipes)
{
sb.AppendFormat("\t - {0}\n", r.ToString());
}
return sb.ToString();
}
#endregion
}
}

@ -1,17 +1,16 @@
using MCTGLib;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Model
{
public interface IPasswordManager
{
public void changePassword(User user, string newPassword);
public string HashPassword(User user);
public bool VerifyPassword(string hashedPassword);
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Model
{
public interface IPasswordManager
{
public void changePassword(User user, string newPassword);
public string HashPassword(User user);
public bool VerifyPassword(string hashedPassword);
}
}

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Model
{
public class PasswordManager : IPasswordManager
{
public void changePassword(User user, string newPassword)
{
throw new NotImplementedException();
}
public string HashPassword(User user)
{
throw new NotImplementedException();
}
public bool VerifyPassword(string hashedPassword)
{
throw new NotImplementedException();
}
}
}

@ -1,19 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MCTGLib
{
/// <summary>
/// This is the list of priorities that user can define in his profil. Priorities
/// are also present in recipes to match the first user's priority with the recipe's priority.
/// </summary>
public enum Priority
{ Economic, Fast, Easy, Light, Gourmet };
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Model
{
/// <summary>
/// This is the list of priorities that user can define in his profil. Priorities
/// are also present in recipes to match the first user's priority with the recipe's priority.
/// </summary>
public enum Priority
{ Economic, Fast, Easy, Light, Gourmet };
}

@ -1,150 +1,150 @@
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.ObjectModel;
using System.Threading.Tasks;
using System.Runtime.CompilerServices;
using System.Text.RegularExpressions;
namespace MCTGLib
{
/// <summary>
/// A user is an entity with a name, a surname, mail, profilePict and a list of priority.
/// This user can login with a Id and password
/// </summary>
public class User : IEquatable<User>
{
#region Private Attributes
private string name="";
private string surname="";
private string mail = "";
private string picture = "";
private string password = "";
//private string defaultUserSavePath = "";
private List<Priority> priorities;
#endregion
#region Properties
/// <summary>
/// Property to get Name of users and a setter
/// </summary>
/// <exception cref="ArgumentException" >Setter have Exception which is trigger when Name is null</exception>
public string Name
{
get { return name; }
private set
{
if (string.IsNullOrWhiteSpace(value))
{
throw new ArgumentException("Impossible d'avoir un champ Nom vide!");
}
name = value;
}
}
/// <summary>
/// Property to get Surname of users and a setter
/// </summary>
/// <exception cref="ArgumentException" >Setter have Exception which is trigger when Surname is null</exception>
public string Surname
{
get { return surname; }
private set
{
if (string.IsNullOrWhiteSpace(value))
{
throw new ArgumentException("Impossible d'avoir un champ Prénom vide!");
}
surname = value;
}
}
/// <summary>
/// Property to get mail of users and a setter
/// </summary>
/// <exception cref="ArgumentException" >User's mail will serve to log the user. So there's no setter, just an init. User will enter one time his email at his
/// account creation.</exception>
public string Mail
{
get { return mail; }
private init
{
if (string.IsNullOrWhiteSpace(value))
{
throw new ArgumentException("Impossible d'avoir un champ Email vide!");
}
mail = value;
}
}
///<summary>
/// Property to initiate password, change it, and
/// </summary>
public string Password
{
get { return password; }
set { password = value; }
}
/// <summary>
/// For now, we define the ProfilPict as a string which is "PhotoParDefaut"
/// when the value is null.
/// </summary>
public string ProfilPict
{
get => picture;
set => picture = value;
}
/// <summary>
/// This is the list of priorities specific tu the user. This list is initiate
/// by default. User could change it at will.
/// </summary>
public List<Priority> Priorities
{
get => priorities;
set=> priorities = value;
}
public bool Equals(User other)
{
return Name.Equals(other.Name) && Surname.Equals(other.Surname) && Mail.Equals(other.Mail) && ;
}
#endregion
#region Constructors
/// <summary>
/// Construtors of user.
/// </summary>
/// <param name="name">The name of the user</param>
/// <param name="surname">The surname of the user</param>
/// <param name="mail">The user needs an email to login. </param>
public User(string name, string surname, string mail)
{
Name = name;
Surname = surname;
Mail = mail;
priorities = new List<Priority> {
Priority.Gourmet,
Priority.Economic,
Priority.Fast,
Priority.Light,
Priority.Easy};
ProfilPict = picture;
}
#endregion
}
}
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.ObjectModel;
using System.Threading.Tasks;
using System.Runtime.CompilerServices;
using System.Text.RegularExpressions;
namespace Model
{
/// <summary>
/// A user is an entity with a name, a surname, mail, profilePict and a list of priority.
/// This user can login with a Id and password
/// </summary>
public class User : IEquatable<User>
{
#region Private Attributes
private string name="";
private string surname="";
private string mail = "";
private string picture = "";
private string password = "";
//private string defaultUserSavePath = "";
private List<Priority> priorities;
#endregion
#region Properties
/// <summary>
/// Property to get Name of users and a setter
/// </summary>
/// <exception cref="ArgumentException" >Setter have Exception which is trigger when Name is null</exception>
public string Name
{
get { return name; }
private set
{
if (string.IsNullOrWhiteSpace(value))
{
throw new ArgumentException("Impossible d'avoir un champ Nom vide!");
}
name = value;
}
}
/// <summary>
/// Property to get Surname of users and a setter
/// </summary>
/// <exception cref="ArgumentException" >Setter have Exception which is trigger when Surname is null</exception>
public string Surname
{
get { return surname; }
private set
{
if (string.IsNullOrWhiteSpace(value))
{
throw new ArgumentException("Impossible d'avoir un champ Prénom vide!");
}
surname = value;
}
}
/// <summary>
/// Property to get mail of users and a setter
/// </summary>
/// <exception cref="ArgumentException" >User's mail will serve to log the user. So there's no setter, just an init. User will enter one time his email at his
/// account creation.</exception>
public string Mail
{
get { return mail; }
private init
{
if (string.IsNullOrWhiteSpace(value))
{
throw new ArgumentException("Impossible d'avoir un champ Email vide!");
}
mail = value;
}
}
///<summary>
/// Property to initiate password, change it, and
/// </summary>
public string Password
{
get { return password; }
set { password = value; }
}
/// <summary>
/// For now, we define the ProfilPict as a string which is "PhotoParDefaut"
/// when the value is null.
/// </summary>
public string ProfilPict
{
get => picture;
set => picture = value;
}
/// <summary>
/// This is the list of priorities specific tu the user. This list is initiate
/// by default. User could change it at will.
/// </summary>
public List<Priority> Priorities
{
get => priorities;
set=> priorities = value;
}
public bool Equals(User other)
{
return Name.Equals(other.Name) && Surname.Equals(other.Surname) && Mail.Equals(other.Mail);
}
#endregion
#region Constructors
/// <summary>
/// Construtors of user.
/// </summary>
/// <param name="name">The name of the user</param>
/// <param name="surname">The surname of the user</param>
/// <param name="mail">The user needs an email to login. </param>
public User(string name, string surname, string mail)
{
Name = name;
Surname = surname;
Mail = mail;
priorities = new List<Priority> {
Priority.Gourmet,
Priority.Economic,
Priority.Fast,
Priority.Light,
Priority.Easy};
ProfilPict = picture;
}
#endregion
}
}

@ -3,28 +3,44 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.33516.290
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp", "MCTGApp\ConsoleApp.csproj", "{666C2211-8EBB-4FC8-9484-CB93BC854153}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp", "ConsoleApp\ConsoleApp.csproj", "{666C2211-8EBB-4FC8-9484-CB93BC854153}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Model", "MCTGLib\Model.csproj", "{42FF86BD-92F9-4A32-A938-68515905378F}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Model", "Model\Model.csproj", "{42FF86BD-92F9-4A32-A938-68515905378F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MCTGLib_UnitTests", "Tests\MCTGLib_UnitTests\MCTGLib_UnitTests.csproj", "{45AB746A-194B-4E43-81EB-83B06F35AA33}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Views", "Views\Views.csproj", "{508B5600-AFD0-4AE4-A3CF-5FA8BE3ECE75}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Model_UnitTests", "Tests\Model_UnitTests\Model_UnitTests.csproj", "{45AB746A-194B-4E43-81EB-83B06F35AA33}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{08B80CE8-A01D-4D86-8989-AF225D5DA48C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
CI|Any CPU = CI|Any CPU
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{666C2211-8EBB-4FC8-9484-CB93BC854153}.CI|Any CPU.ActiveCfg = Release|Any CPU
{666C2211-8EBB-4FC8-9484-CB93BC854153}.CI|Any CPU.Build.0 = Release|Any CPU
{666C2211-8EBB-4FC8-9484-CB93BC854153}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{666C2211-8EBB-4FC8-9484-CB93BC854153}.Debug|Any CPU.Build.0 = Debug|Any CPU
{666C2211-8EBB-4FC8-9484-CB93BC854153}.Release|Any CPU.ActiveCfg = Release|Any CPU
{666C2211-8EBB-4FC8-9484-CB93BC854153}.Release|Any CPU.Build.0 = Release|Any CPU
{42FF86BD-92F9-4A32-A938-68515905378F}.CI|Any CPU.ActiveCfg = Release|Any CPU
{42FF86BD-92F9-4A32-A938-68515905378F}.CI|Any CPU.Build.0 = Release|Any CPU
{42FF86BD-92F9-4A32-A938-68515905378F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{42FF86BD-92F9-4A32-A938-68515905378F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{42FF86BD-92F9-4A32-A938-68515905378F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{42FF86BD-92F9-4A32-A938-68515905378F}.Release|Any CPU.Build.0 = Release|Any CPU
{508B5600-AFD0-4AE4-A3CF-5FA8BE3ECE75}.CI|Any CPU.ActiveCfg = CI|Any CPU
{508B5600-AFD0-4AE4-A3CF-5FA8BE3ECE75}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{508B5600-AFD0-4AE4-A3CF-5FA8BE3ECE75}.Debug|Any CPU.Build.0 = Debug|Any CPU
{508B5600-AFD0-4AE4-A3CF-5FA8BE3ECE75}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{508B5600-AFD0-4AE4-A3CF-5FA8BE3ECE75}.Release|Any CPU.ActiveCfg = Release|Any CPU
{508B5600-AFD0-4AE4-A3CF-5FA8BE3ECE75}.Release|Any CPU.Build.0 = Release|Any CPU
{508B5600-AFD0-4AE4-A3CF-5FA8BE3ECE75}.Release|Any CPU.Deploy.0 = Release|Any CPU
{45AB746A-194B-4E43-81EB-83B06F35AA33}.CI|Any CPU.ActiveCfg = Release|Any CPU
{45AB746A-194B-4E43-81EB-83B06F35AA33}.CI|Any CPU.Build.0 = Release|Any CPU
{45AB746A-194B-4E43-81EB-83B06F35AA33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{45AB746A-194B-4E43-81EB-83B06F35AA33}.Debug|Any CPU.Build.0 = Debug|Any CPU
{45AB746A-194B-4E43-81EB-83B06F35AA33}.Release|Any CPU.ActiveCfg = Release|Any CPU

@ -22,8 +22,13 @@
</PackageReference>
</ItemGroup>
<<<<<<< HEAD:MCTG/Tests/MCTGLib_UnitTests/MCTGLib_UnitTests.csproj
<ItemGroup>
<ProjectReference Include="..\..\MCTGLib\Model.csproj" />
=======
<ItemGroup>
<ProjectReference Include="..\..\Model\Model.csproj" />
>>>>>>> dev-model:MCTG/Tests/Model_UnitTests/Model_UnitTests.csproj
</ItemGroup>
</Project>

@ -0,0 +1,26 @@
using Model;
namespace Model_UnitTests
{
public class Recipe_UT
{
[Fact]
public void TestVoidConstructor()
{
Recipe r = new Recipe(id: 999); // 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