using MaBibli.Shared.Dtos;
using MaBibli.Shared.Entites;

namespace MaBibli.Tests;

public class ThemesTests
{
    [Fact]
    public void La_saisie_des_themes_separe_par_virgules_et_dedoublonne_sans_accents()
    {
        var themes = EnregistrementLivre.DecouperThemes(
            "Dark Fantasy, science-fiction, dark fantasy,  , SCIENCE FICTION");

        Assert.Equal(["Dark Fantasy", "science-fiction"], themes);
    }

    [Fact]
    public void Un_theme_recalcule_sa_forme_normalisee()
    {
        var theme = new Theme { Nom = "  Cœur d'aventure  " };

        theme.RecalculerFormes();

        Assert.Equal("Cœur d'aventure", theme.Nom);
        Assert.Equal("coeur d aventure", theme.NomNormalise);
    }
}
