- Created MSTestSettings.cs to enable parallel test execution. - Added StyleTests.cs and TitreTests.cs for unit testing of Style and Titre entities. - Implemented Webzine.Entity.Tests project with necessary configurations. - Created SeedDataLocal.cs and SeedDataSpotify.cs for local and Spotify data seeding. - Established repository contracts for Artiste, Commentaire, Style, and Titre. - Developed DbEntityRepository and LocalEntityRepository classes. - Set up Webzine.WebApplication with controllers, logging, and Docker support. - Configured NLog for logging and added necessary appsettings for development. - Created initial views and layout for the web application. - Added Dockerfile and docker-compose configuration for containerization.
242 lines
6.6 KiB
C#
242 lines
6.6 KiB
C#
namespace Webzine.Entity.Tests
|
|
{
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
|
|
/// <summary>
|
|
/// Tests de l'entité <see cref="Titre"/>.
|
|
/// Vérifie que les contraintes imposées (nom du champ, longueur max du champ,
|
|
/// champ obligatoire, libellé du champ, clé primaire...) sont bien respectées.
|
|
/// </summary>
|
|
[TestClass]
|
|
public class TitreTests
|
|
{
|
|
[TestMethod]
|
|
public void TitreHasIdTitre()
|
|
{
|
|
Common.HasProperty(typeof(Titre), nameof(Titre.IdTitre));
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TitreHasIdArtiste()
|
|
{
|
|
Common.HasProperty(typeof(Titre), nameof(Titre.IdArtiste));
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TitreHasArtiste()
|
|
{
|
|
Common.HasProperty(typeof(Titre), nameof(Titre.Artiste));
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TitreHasLibelle()
|
|
{
|
|
Common.HasProperty(typeof(Titre), nameof(Titre.Libelle));
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TitreHasLibelleDisplayValid()
|
|
{
|
|
Common.AttributDisplay(typeof(Titre), nameof(Titre.Libelle), "Titre");
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TitreHasLibelleRequis()
|
|
{
|
|
Common.AttributRequis(typeof(Titre), nameof(Titre.Libelle));
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TitreHasLibelleTailleMin1()
|
|
{
|
|
Common.AttributLongueurMin(typeof(Titre), nameof(Titre.Libelle), 1);
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TitreHasLibelleTailleMax200()
|
|
{
|
|
Common.AttributLongueurMax(typeof(Titre), nameof(Titre.Libelle), 200);
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TitreHasChronique()
|
|
{
|
|
Common.HasProperty(typeof(Titre), nameof(Titre.Chronique));
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TitreHasChroniqueRequis()
|
|
{
|
|
Common.AttributRequis(typeof(Titre), nameof(Titre.Chronique));
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TitreHasChroniqueTailleMin10()
|
|
{
|
|
Common.AttributLongueurMin(typeof(Titre), nameof(Titre.Chronique), 10);
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TitreHasChroniqueTailleMax4000()
|
|
{
|
|
Common.AttributLongueurMax(typeof(Titre), nameof(Titre.Chronique), 4000);
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TitreHasDateCreation()
|
|
{
|
|
Common.HasProperty(typeof(Titre), nameof(Titre.DateCreation));
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TitreHasDateCreationRequis()
|
|
{
|
|
Common.AttributRequis(typeof(Titre), nameof(Titre.DateCreation));
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TitreHasDateCreationDisplayValid()
|
|
{
|
|
Common.AttributDisplay(typeof(Titre), nameof(Titre.DateCreation), "Date de création");
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TitreHasDuree()
|
|
{
|
|
Common.HasProperty(typeof(Titre), nameof(Titre.Duree));
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TitreHasDureeDisplayValid()
|
|
{
|
|
Common.AttributDisplay(typeof(Titre), nameof(Titre.Duree), "Durée en secondes");
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TitreHasDateSortie()
|
|
{
|
|
Common.HasProperty(typeof(Titre), nameof(Titre.DateSortie));
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TitreHasDateSortieRequis()
|
|
{
|
|
Common.AttributRequis(typeof(Titre), nameof(Titre.DateSortie));
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TitreHasDateSortieDisplayValid()
|
|
{
|
|
Common.AttributDisplay(typeof(Titre), nameof(Titre.DateSortie), "Date de sortie");
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TitreHasUrlJaquette()
|
|
{
|
|
Common.HasProperty(typeof(Titre), nameof(Titre.UrlJaquette));
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TitreHasUrlJaquetteRequis()
|
|
{
|
|
Common.AttributRequis(typeof(Titre), nameof(Titre.UrlJaquette));
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TitreHasUrlJaquetteDisplayValid()
|
|
{
|
|
Common.AttributDisplay(typeof(Titre), nameof(Titre.UrlJaquette), "Jaquette de l'album");
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TitreHasUrlJaquetteTailleMax250()
|
|
{
|
|
Common.AttributLongueurMax(typeof(Titre), nameof(Titre.UrlJaquette), 250);
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TitreHasUrlEcoute()
|
|
{
|
|
Common.HasProperty(typeof(Titre), nameof(Titre.UrlEcoute));
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TitreHasUrlEcouteDisplayValid()
|
|
{
|
|
Common.AttributDisplay(typeof(Titre), nameof(Titre.UrlEcoute), "URL d'écoute");
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TitreHasUrlEcouteTailleMin13()
|
|
{
|
|
Common.AttributLongueurMin(typeof(Titre), nameof(Titre.UrlEcoute), 13);
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TitreHasUrlEcouteTailleMax250()
|
|
{
|
|
Common.AttributLongueurMax(typeof(Titre), nameof(Titre.UrlEcoute), 250);
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TitreHasNbLectures()
|
|
{
|
|
Common.HasProperty(typeof(Titre), nameof(Titre.NbLectures));
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TitreHasNbLecturesDisplayValid()
|
|
{
|
|
Common.AttributDisplay(typeof(Titre), nameof(Titre.NbLectures), "Nombre de lectures");
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TitreHasNbLecturesRequis()
|
|
{
|
|
Common.AttributRequis(typeof(Titre), nameof(Titre.NbLectures));
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TitreHasNbLikes()
|
|
{
|
|
Common.HasProperty(typeof(Titre), nameof(Titre.NbLikes));
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TitreHasNbLikesDisplayValid()
|
|
{
|
|
Common.AttributDisplay(typeof(Titre), nameof(Titre.NbLikes), "Nombre de likes");
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TitreHasNbLikesRequis()
|
|
{
|
|
Common.AttributRequis(typeof(Titre), nameof(Titre.NbLikes));
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TitreHasAlbum()
|
|
{
|
|
Common.HasProperty(typeof(Titre), nameof(Titre.Album));
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TitreHasAlbumRequis()
|
|
{
|
|
Common.AttributRequis(typeof(Titre), nameof(Titre.Album));
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TitreHasCommentaires()
|
|
{
|
|
Common.HasProperty(typeof(Titre), nameof(Titre.Commentaires));
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TitreUrlJaquetteeIsNotMandatory()
|
|
{
|
|
Common.AttributHasNotUrlValidation(typeof(Titre), nameof(Titre.UrlJaquette));
|
|
}
|
|
}
|
|
}
|