|
|
@ -9,24 +9,17 @@ namespace UnitTests
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public class UnitTestOeuvre
|
|
|
|
public class UnitTestOeuvre
|
|
|
|
{
|
|
|
|
{
|
|
|
|
[Fact]
|
|
|
|
[Theory]
|
|
|
|
public void Oeuvre_Constructor_WithAllParameters_ShouldSetPropertiesCorrectly()
|
|
|
|
[InlineData("[Oshi No Ko]", new string[] { "Action", "Drama", "Fantasy" }, "TV Series", "A thrilling anime series.", 9, 25, "oshinoko.png")]
|
|
|
|
|
|
|
|
public void Oeuvre_Constructor_WithAllParameters_ShouldSetPropertiesCorrectly(
|
|
|
|
|
|
|
|
string nom, string[] genres, string type, string description, int note, int nbEpisodes, string affiche)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Arrange
|
|
|
|
// Arrange & Act
|
|
|
|
string nom = "[Oshi No Ko]";
|
|
|
|
Oeuvre oeuvre = new Oeuvre(nom, new List<string>(genres), type, description, note, nbEpisodes, affiche);
|
|
|
|
List<string> genre = new List<string> { "Action", "Drama", "Fantasy" };
|
|
|
|
|
|
|
|
string type = "TV Series";
|
|
|
|
|
|
|
|
string description = "A thrilling anime series.";
|
|
|
|
|
|
|
|
int note = 9;
|
|
|
|
|
|
|
|
int nbEpisodes = 25;
|
|
|
|
|
|
|
|
string affiche = "oshinoko.png";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Act
|
|
|
|
|
|
|
|
Oeuvre oeuvre = new Oeuvre(nom, genre, type, description, note, nbEpisodes, affiche);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Assert
|
|
|
|
// Assert
|
|
|
|
Assert.Equal(nom, oeuvre.Nom);
|
|
|
|
Assert.Equal(nom, oeuvre.Nom);
|
|
|
|
Assert.Equal(genre, oeuvre.Genre);
|
|
|
|
Assert.Equal(new List<string>(genres), oeuvre.Genre);
|
|
|
|
Assert.Equal(type, oeuvre.Type);
|
|
|
|
Assert.Equal(type, oeuvre.Type);
|
|
|
|
Assert.Equal(description, oeuvre.Description);
|
|
|
|
Assert.Equal(description, oeuvre.Description);
|
|
|
|
Assert.Equal(note, oeuvre.Note);
|
|
|
|
Assert.Equal(note, oeuvre.Note);
|
|
|
@ -34,17 +27,12 @@ namespace UnitTests
|
|
|
|
Assert.Equal(affiche, oeuvre.Affiche);
|
|
|
|
Assert.Equal(affiche, oeuvre.Affiche);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
[Theory]
|
|
|
|
public void Oeuvre_Constructor_WithRequiredParameters_ShouldSetPropertiesCorrectly()
|
|
|
|
[InlineData("One Piece", "TV Series", "An epic adventure.", 1000, "onepiece.jpg")]
|
|
|
|
|
|
|
|
public void Oeuvre_Constructor_WithRequiredParameters_ShouldSetPropertiesCorrectly(
|
|
|
|
|
|
|
|
string nom, string type, string description, int nbEpisodes, string affiche)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Arrange
|
|
|
|
// Arrange & Act
|
|
|
|
string nom = "One Piece";
|
|
|
|
|
|
|
|
string type = "TV Series";
|
|
|
|
|
|
|
|
string description = "An epic adventure.";
|
|
|
|
|
|
|
|
int nbEpisodes = 1000;
|
|
|
|
|
|
|
|
string affiche = "onepiece.jpg";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Act
|
|
|
|
|
|
|
|
Oeuvre oeuvre = new Oeuvre(nom, type, description, nbEpisodes, affiche);
|
|
|
|
Oeuvre oeuvre = new Oeuvre(nom, type, description, nbEpisodes, affiche);
|
|
|
|
|
|
|
|
|
|
|
|
// Assert
|
|
|
|
// Assert
|
|
|
@ -57,12 +45,14 @@ namespace UnitTests
|
|
|
|
Assert.Equal(affiche, oeuvre.Affiche);
|
|
|
|
Assert.Equal(affiche, oeuvre.Affiche);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
[Theory]
|
|
|
|
public void AjouterEpisode_ShouldIncreaseNbEpisodesByGivenAmount()
|
|
|
|
[InlineData("Naruto", "TV Series", "A ninja's journey.", 220, "evangelion.jpg", 50)]
|
|
|
|
|
|
|
|
[InlineData("Dragon Ball", "TV Series", "A Saiyan's story.", 291, "evangelion.jpg", 20)]
|
|
|
|
|
|
|
|
public void AjouterEpisode_ShouldIncreaseNbEpisodesByGivenAmount(
|
|
|
|
|
|
|
|
string nom, string type, string description, int nbEpisodes, string affiche, int nbEpisodesToAdd)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Arrange
|
|
|
|
// Arrange
|
|
|
|
Oeuvre oeuvre = new Oeuvre("Naruto", "TV Series", "A ninja's journey.", 220, "evangelion.jpg");
|
|
|
|
Oeuvre oeuvre = new Oeuvre(nom, type, description, nbEpisodes, affiche);
|
|
|
|
int nbEpisodesToAdd = 50;
|
|
|
|
|
|
|
|
int expectedNbEpisodes = oeuvre.NbEpisodes + nbEpisodesToAdd;
|
|
|
|
int expectedNbEpisodes = oeuvre.NbEpisodes + nbEpisodesToAdd;
|
|
|
|
|
|
|
|
|
|
|
|
// Act
|
|
|
|
// Act
|
|
|
@ -71,6 +61,5 @@ namespace UnitTests
|
|
|
|
// Assert
|
|
|
|
// Assert
|
|
|
|
Assert.Equal(expectedNbEpisodes, oeuvre.NbEpisodes);
|
|
|
|
Assert.Equal(expectedNbEpisodes, oeuvre.NbEpisodes);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|