Merge j1/feat/accueil to dev
This commit is contained in:
63
Webzine.Repository/Fake/TitreFactory.cs
Normal file
63
Webzine.Repository/Fake/TitreFactory.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Faker;
|
||||
using Webzine.Entity;
|
||||
|
||||
namespace Webzine.Repository.Fake
|
||||
{
|
||||
public static class FakeDataFactory
|
||||
{
|
||||
//https://cdn-images.dzcdn.net/images/cover/311bba0fc112d15f72c8b5a65f0456c1/1900x1900-000000-80-0-0.jpg",
|
||||
public static List<Artiste> GetArtistes(int count = 10)
|
||||
{
|
||||
var artistes = new List<Artiste>();
|
||||
|
||||
for (int i = 1; i <= count; i++)
|
||||
{
|
||||
artistes.Add(new Artiste
|
||||
{
|
||||
IdArtiste = i,
|
||||
Nom = Name.FullName(),
|
||||
Biographie = Lorem.Paragraph(),
|
||||
Titres = new List<Titre>()
|
||||
});
|
||||
}
|
||||
|
||||
return artistes;
|
||||
}
|
||||
|
||||
public static List<Titre> GetTitres(int count = 40)
|
||||
{
|
||||
var artistes = GetArtistes();
|
||||
var titres = new List<Titre>();
|
||||
|
||||
for (int i = 1; i <= count; i++)
|
||||
{
|
||||
var artiste = artistes[RandomNumber.Next(0, artistes.Count - 1)];
|
||||
|
||||
var titre = new Titre
|
||||
{
|
||||
IdTitre = i,
|
||||
IdArtiste = artiste.IdArtiste,
|
||||
Artiste = artiste,
|
||||
Libelle = Lorem.Sentence(3),
|
||||
Chronique = Lorem.Paragraph(),
|
||||
DateCreation = DateTime.Now.AddDays(-RandomNumber.Next(1, 100)),
|
||||
DateSortie = DateTime.Now.AddYears(-RandomNumber.Next(1, 20)),
|
||||
Duree = RandomNumber.Next(120, 420),
|
||||
UrlJaquette = "https://picsum.photos/300",
|
||||
UrlEcoute = Internet.Url(),
|
||||
NbLectures = RandomNumber.Next(0, 500),
|
||||
NbLikes = RandomNumber.Next(0, 200),
|
||||
Album = Lorem.Sentence(2),
|
||||
Commentaires = new List<Commentaire>()
|
||||
};
|
||||
|
||||
titres.Add(titre);
|
||||
artiste.Titres.Add(titre);
|
||||
}
|
||||
|
||||
return titres;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,13 +24,6 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Webzine.Entity\Webzine.Entity.csproj" />
|
||||
<ProjectReference Include="..\Webzine.Repository.Contracts\Webzine.Repository.Contracts.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.Testing.Platform">
|
||||
<HintPath>..\..\..\..\..\..\..\.nuget\packages\microsoft.testing.platform\2.0.1\lib\net9.0\Microsoft.Testing.Platform.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user