diff --git a/Webzine.Entity/Fixtures/ArtisteFactory.cs b/Webzine.Entity/Fixtures/ArtisteFactory.cs
new file mode 100644
index 0000000..e9af87b
--- /dev/null
+++ b/Webzine.Entity/Fixtures/ArtisteFactory.cs
@@ -0,0 +1,54 @@
+using Bogus;
+
+namespace Webzine.Entity.Fixtures
+{
+ ///
+ /// Factory pour générer des artistes avec des titres associés, à l'aide de la bibliothèque Bogus.
+ ///
+ ///
+ public class ArtisteFactory
+ {
+ ///
+ /// Récupère un artiste par son nom, en générant des données fictives pour ses titres associés.
+ ///
+ ///
+ ///
+ public static Artiste SeedArtisteByName(string nom)
+ {
+ // On définit nos albums "bouchonnés"
+ var albumsData = new[]
+ {
+ new { Nom = "Bohemian Rhapsody", Image = "https://upload.wikimedia.org/wikipedia/en/9/9f/Bohemian_Rhapsody.png" },
+ new { Nom = "Born This Way", Image = "https://static.wikia.nocookie.net/ladygaga/images/2/2d/BornThisWay-DeluxeEdition.jpg/revision/latest/scale-to-width-down/3500?cb=20111120030308" }
+ };
+
+ var faker = new Bogus.Faker("fr");
+ var tousLesTitres = new List();
+
+ // Pour chaque album, on génère un paquet de titres
+ foreach (var album in albumsData)
+ {
+ var nombreDeTitres = faker.Random.Number(3, 6);
+
+ var titresDeLalbum = new Faker("fr")
+ .RuleFor(t => t.IdTitre, f => f.IndexFaker + 1 + tousLesTitres.Count)
+ .RuleFor(t => t.UrlJaquette, _ => album.Image)
+ .RuleFor(t => t.Album, _ => album.Nom)
+ .RuleFor(t => t.Duree, f => f.Random.Number(90, 180))
+ .RuleFor(t => t.Libelle, f => f.Music.Genre() + " - " + f.Commerce.ProductName())
+ .Generate(nombreDeTitres);
+
+ tousLesTitres.AddRange(titresDeLalbum);
+ }
+
+ // On crée l'artiste final
+ var artisteFaker = new Faker("fr")
+ .RuleFor(a => a.IdArtiste, f => f.IndexFaker + 1)
+ .RuleFor(a => a.Nom, _ => nom)
+ .RuleFor(a => a.Biographie, f => f.Lorem.Paragraphs(2))
+ .RuleFor(a => a.Titres, _ => tousLesTitres);
+
+ return artisteFaker.Generate();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Webzine.Entity/Style.cs b/Webzine.Entity/Style.cs
index 11c6f32..ed1cd12 100644
--- a/Webzine.Entity/Style.cs
+++ b/Webzine.Entity/Style.cs
@@ -18,5 +18,6 @@ namespace Webzine.Entity
[Display(Name = "Libellé")]
public string Libelle { get; set; }
+ public List Titres { get; set; } = new List();
}
}
diff --git a/Webzine.Entity/Titre.cs b/Webzine.Entity/Titre.cs
index f8d299c..6775064 100644
--- a/Webzine.Entity/Titre.cs
+++ b/Webzine.Entity/Titre.cs
@@ -63,5 +63,6 @@ namespace Webzine.Entity
public List Commentaires { get; set; }
+ public List