Ajoute les thèmes communs sur les fiches de livres
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
co-authored by
Copilot
parent
e28d5bce32
commit
c2d408afc6
@@ -39,15 +39,44 @@ public class ServiceCatalogueTests : IDisposable
|
||||
string? auteur = null,
|
||||
string? isbn = null,
|
||||
Format format = Format.Physique,
|
||||
Statut? statut = null) => new()
|
||||
Statut? statut = null,
|
||||
params string[] themes) => new()
|
||||
{
|
||||
Titre = titre,
|
||||
Auteur = auteur,
|
||||
Isbn = isbn,
|
||||
Format = format,
|
||||
Statut = statut,
|
||||
Themes = themes.ToList(),
|
||||
};
|
||||
|
||||
[Fact]
|
||||
public async Task Les_themes_sont_communs_et_normalises()
|
||||
{
|
||||
var premier = (await _service.CreerAsync(
|
||||
Saisie("Dune", themes: ["Science-fiction", "Dark Fantasy"]), "mathieu")).Livre!;
|
||||
var second = (await _service.CreerAsync(
|
||||
Saisie("Fondation", themes: ["science-fiction", "dark fantasy"]), "camille")).Livre!;
|
||||
|
||||
Assert.Equal(["Dark Fantasy", "Science-fiction"], premier.Themes);
|
||||
Assert.Equal(["Dark Fantasy", "Science-fiction"], second.Themes);
|
||||
Assert.Equal(2, await _db.Themes.CountAsync());
|
||||
Assert.Equal(4, await _db.LivreThemes.CountAsync());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Modifier_remplace_les_themes_du_livre()
|
||||
{
|
||||
var livre = (await _service.CreerAsync(
|
||||
Saisie("Dune", themes: ["Science-fiction", "Space opera"]), "mathieu")).Livre!;
|
||||
|
||||
var modifie = await _service.ModifierAsync(
|
||||
livre.Id, Saisie("Dune", themes: ["space OPERA", "Aventure"]), "mathieu");
|
||||
|
||||
Assert.Equal(["Aventure", "Space opera"], modifie.Livre!.Themes);
|
||||
Assert.Equal(2, await _db.LivreThemes.CountAsync());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Creer_enregistre_le_livre_et_trace_lauteur_de_la_saisie()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user