You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
SAE-2.01/MCTG/Tests/Model_UnitTests/Recipe_UT.cs

34 lines
1.3 KiB

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);
Assert.NotNull(r.Description);
}
[Theory]
[InlineData("Cookies", "Choco Cookies", 23, "Cookies", "Choco Cookies", 23)]
[InlineData("Cookies", "No description.", 1, "Cookies", "", 1)]
[InlineData("No title.", "Choco Cookies", 1, "", "Choco Cookies", 1)]
[InlineData("Cookies", "Choco Cookies", 0, "Cookies", "Choco Cookies", null)]
[InlineData("Cookies", "No description.", 1, "Cookies", null, 1)]
[InlineData("No title.", "Choco Cookies", 1, null, "Choco Cookies", 1)]
public void TestConstructor(string expectedTitle, string expectedDescription, int expectedId,
string title, string description, int? id)
{
Recipe r = new Recipe(title, description, id);
Assert.NotNull(r.Title);
Assert.NotNull(r.Description);
Assert.Equal(expectedId, r.Id);
Assert.Equal(expectedTitle, r.Title);
Assert.Equal(expectedDescription, r.Description);
}
}
}