From 07be5fdfac30f81c85471986eaade8a2c8d1ced0 Mon Sep 17 00:00:00 2001 From: "josephine.vetu" Date: Sat, 28 Mar 2026 10:35:00 +0100 Subject: [PATCH] Suppression des datafactory du jalon non utilisees. --- Webzine.Entity/Fixtures/ArtisteFactory.cs | 53 ----- Webzine.Entity/Fixtures/CommentaireFactory.cs | 12 - Webzine.Entity/Fixtures/DataFactory.cs | 209 ------------------ Webzine.Entity/Fixtures/StyleFactory.cs | 12 - Webzine.Entity/Fixtures/TitreFactory.cs | 78 ------- 5 files changed, 364 deletions(-) delete mode 100644 Webzine.Entity/Fixtures/ArtisteFactory.cs delete mode 100644 Webzine.Entity/Fixtures/CommentaireFactory.cs delete mode 100644 Webzine.Entity/Fixtures/DataFactory.cs delete mode 100644 Webzine.Entity/Fixtures/StyleFactory.cs delete mode 100644 Webzine.Entity/Fixtures/TitreFactory.cs diff --git a/Webzine.Entity/Fixtures/ArtisteFactory.cs b/Webzine.Entity/Fixtures/ArtisteFactory.cs deleted file mode 100644 index ab0e11a..0000000 --- a/Webzine.Entity/Fixtures/ArtisteFactory.cs +++ /dev/null @@ -1,53 +0,0 @@ -namespace Webzine.Entity.Fixtures -{ - using Bogus; - - /// - /// 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. - /// - /// Le nom de l'artiste à générer. - /// Un objet Artiste avec des titres associés générés de manière aléatoire. - 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/Fixtures/CommentaireFactory.cs b/Webzine.Entity/Fixtures/CommentaireFactory.cs deleted file mode 100644 index a756b49..0000000 --- a/Webzine.Entity/Fixtures/CommentaireFactory.cs +++ /dev/null @@ -1,12 +0,0 @@ -// -// Copyright (c) PlaceholderCompany. All rights reserved. -// - -namespace Webzine.Entity.Fixtures -{ - using Bogus; - - public class CommentaireFactory - { - } -} \ No newline at end of file diff --git a/Webzine.Entity/Fixtures/DataFactory.cs b/Webzine.Entity/Fixtures/DataFactory.cs deleted file mode 100644 index 23452f9..0000000 --- a/Webzine.Entity/Fixtures/DataFactory.cs +++ /dev/null @@ -1,209 +0,0 @@ -namespace Webzine.Entity.Fixtures; - -using System; -using System.Collections.Generic; -using System.Linq; - -using Entity; - -using Faker; - -public class DataFactory -{ - /// - /// Dictionnaire contenant des données de musique réelles pour les titres générés. - /// - public Dictionary RealMusicData { get; set; } - = new Dictionary - { - { - "juliana_chahayed_1", ("https://open.spotify.com/intl-fr/track/0qYLUdJQMhrCFA9dNZGcnm?si=b4fd45727a354a31", - "https://i.scdn.co/image/ab67616d0000b2738e8e7b8f8f8f8f8f8f8f8f8") - }, - { - "mister_v_1", ("https://youtu.be/JeqUw7sGUK8?si=FnmFR2EgkVY6MhqQ", - "https://img.youtube.com/vi/JeqUw7sGUK8/maxresdefault.jpg") - }, - { - "compagnie_creole_1", ("https://youtu.be/wfxt1SGWAI8", - "https://img.youtube.com/vi/wfxt1SGWAI8/maxresdefault.jpg") - }, - { - "femto_1", ("https://open.spotify.com/intl-fr/track/0qYLUdJQMhrCFA9dNZGcnm?si=b4fd45727a354a31", - "https://i.scdn.co/image/ab67616d0000b2738e8e7b8f8f8f8f8f8f8f8f8") - }, - { - "chat_noir_1", ("https://youtu.be/OTi4-q-_Tj0?si=SNnLd-6Y893nL5Au", - "https://img.youtube.com/vi/OTi4-q-_Tj0/maxresdefault.jpg") - }, - { - "chat_noir_2", ("https://youtu.be/X-rJ01EyiAI?si=gH9m_U8oXI35OgWu", - "https://img.youtube.com/vi/X-rJ01EyiAI/maxresdefault.jpg") - }, - { - "chat_noir_3", ("https://youtu.be/7lIM0wSx7kQ?si=S-RAsLzd4SiCQhE4", - "https://img.youtube.com/vi/7lIM0wSx7kQ/maxresdefault.jpg") - }, - { - "chat_noir_4", ("https://youtu.be/dbxyKR1P8vA?si=aRzdYBhwvKptV8Ff", - "https://img.youtube.com/vi/dbxyKR1P8vA/maxresdefault.jpg") - }, - { - "chat_noir_5", ("https://youtu.be/DDHvKo5NnII?si=NFRkdVQL2mELP0yn", - "https://img.youtube.com/vi/DDHvKo5NnII/maxresdefault.jpg") - }, - { - "chat_noir_6", ("https://youtu.be/J9LgHNf2Qy0?si=YGO1ggiLkefa9901", - "https://img.youtube.com/vi/J9LgHNf2Qy0/maxresdefault.jpg") - }, - { - "chat_noir_7", ("https://youtu.be/oadhHk2xs6c?si=mbnJCA6SGsoYXnUK", - "https://img.youtube.com/vi/oadhHk2xs6c/maxresdefault.jpg") - }, - { - "chat_noir_8", ("https://youtu.be/6K1zCgkBaoE?si=quq9vQLJ-AmzjRJJ", - "https://img.youtube.com/vi/6K1zCgkBaoE/maxresdefault.jpg") - }, - { - "german_rapper_1", ("https://www.youtube.com/watch?v=DWpg71HJt24", - "https://img.youtube.com/vi/DWpg71HJt24/maxresdefault.jpg") - }, - { - "nizard_1", ("https://youtu.be/1fjA68k8DAU?si=2PuZSquVQGvfmQkZ", - "https://img.youtube.com/vi/1fjA68k8DAU/maxresdefault.jpg") - }, - }; - - /// - /// Génère une liste d'artistes de musique en utilisant la bibliothèque Faker pour créer des noms d'artistes et des biographies réalistes. - /// - /// Nombre d'artistes à générer. - /// Liste d'artistes de musique générés. - public List GenerateArtists(int count) - { - var artists = new List(); - - for (int i = 0; i < count; i++) - { - artists.Add(new Artiste - { - IdArtiste = i + 1, - Nom = Name.FullName(), - Biographie = Lorem.Paragraph(), - Titres = new List(), - }); - } - - return artists; - } - - /// - /// Génère une liste de styles de musique à partir d'une liste prédéfinie de noms de styles. - /// - /// Nombre de styles à générer (maximum 15, car il y a 15 styles prédéfinis). - /// Liste de styles de musique générés. - public List