@ -14,21 +14,20 @@ namespace TestUnitaires
[InlineData("Réference")]
public void TU_Methods ( string? test )
{
Playlist p = new Playlist ( test , "PlaceHolder" , "place.holder" ) ;
Album album = new Album ( test , "place.holder" , new Artist ( "test" ) , "PlaceHolder" , "PlaceHolder" ) ;
CustomTitle t = new CustomTitle ( test , "test. mp3" , "Banger" , "path" ) ;
Artist artist = new Artist ( test ) ;
LinqXmlSerialization l = new LinqXmlSerialization ( Path . Combine ( AppDomain . CurrentDomain . BaseDirectory , "Data" ) ) ;
InfoTitle info = new InfoTitle ( test , "url.test" , "infos" , "desc" , Genre . POP , 345 ) ;
/ * Assert . NotEmpty ( l . Albums ) ;
Playlist p = new ( test , "PlaceHolder" , "place.holder" ) ;
Album album = new ( test , "place.holder" , new Artist ( "test" ) , "PlaceHolder" , "PlaceHolder" ) ;
CustomTitle t = new ( test , "test. mp3" , "Banger" , "path" ) ;
Artist artist = new ( test ) ;
InfoTitle info = new ( test , "url.test" , "infos" , "desc" , Genre . POP , 345 ) ;
LinqXmlSerialization l = new ( Path . Combine ( AppDomain . CurrentDomain . BaseDirectory , "Data" ) ) ;
Assert . NotEmpty ( l . Albums ) ;
Assert . NotEmpty ( l . Artists ) ;
Assert . NotEmpty ( l . InfoTitles ) ;
Assert . NotEmpty ( l . Playlists ) ;
Assert . NotEmpty ( l . CustomTitles ) ; * /
l . AddCustomTitle ( t ) ;
Assert . Empty ( l . Playlists ) ;
Assert . Empty ( l . CustomTitles ) ;
l . AddPlaylist ( p ) ;
l . AddAlbum ( album ) ;
l . AddCustomTitle ( t ) ;
l . AddArtist ( artist ) ;
l . AddInfoTitle ( info ) ;
Assert . Contains ( t , l . CustomTitles ) ;
@ -59,6 +58,57 @@ namespace TestUnitaires
Assert . Equal ( l . GetInfoTitleByName ( test ) , info ) ;
Assert . Equal ( l . GetArtistByName ( test ) , artist ) ;
}
[Theory]
[InlineData("Imagine Dragons")]
[InlineData("Nepal")]
[InlineData("Booba")]
public void TU_ExistsArtist_Method ( string name )
{
LinqXmlSerialization l = new ( Path . Combine ( AppDomain . CurrentDomain . BaseDirectory , "Data" ) ) ;
Assert . True ( l . ExistsArtist ( new Artist ( name ) ) ) ;
Assert . True ( l . ExistsArtistByName ( name ) ) ;
}
[Theory]
[InlineData("Fenêtre Sur Rue", "album2. jpg", "Hugo TSR", "Un banger", "Sortie : 2012")]
[InlineData("Adios Bahamas", "album1.jpg", "Nepal", "Album post-mortem qui signé également le dernier de l'artiste", "Sortie : 2020")]
public void TU_ExistsAlbum_Method ( string name , string imageURL , string artistName , string desc , string info )
{
LinqXmlSerialization l = new ( Path . Combine ( AppDomain . CurrentDomain . BaseDirectory , "Data" ) ) ;
Assert . True ( l . ExistsAlbum ( new Album ( name , imageURL , new Artist ( artistName ) , desc , info ) ) ) ;
Assert . True ( l . ExistsAlbumByName ( name ) ) ;
}
[Theory]
[InlineData("Trajectoire", "morceau1.png", "Sortie : 2020", "Morceau de Népal", Genre.HIP_HOP, 0)]
[InlineData("Bones", "album14.jpg", "Titre de l'album Mercury Act 2", "La chanson \"Bones\" a été publiée en tant que premier single de Mercury - Act 2 le 11 mars 2022. La chanson a été utilisée pour promouvoir la troisième saison de la série Amazon Prime Video The Boys. La sortie du clip de la chanson le 6 avril a coïncidé avec la précommande de l'album.", Genre.POP, 13)]
public void TU_ExistsInfoTitles_Method ( string name , string imageURL , string desc , string info , Genre genre , long id )
{
LinqXmlSerialization l = new ( Path . Combine ( AppDomain . CurrentDomain . BaseDirectory , "Data" ) ) ;
Assert . True ( l . ExistsInfoTitle ( new InfoTitle ( name , imageURL , desc , info , genre , id ) ) ) ;
Assert . True ( l . ExistsInfoTitleByName ( name ) ) ;
}
[Theory]
[InlineData("Trajectoire", "morceau1.png", "Sortie : 2020")]
[InlineData("Bones", "album14.jpg", "Titre de l'album Mercury Act 2")]
public void TU_ExistsPlaylist_Method ( string name , string imageURL , string desc )
{
LinqXmlSerialization l = new ( Path . Combine ( AppDomain . CurrentDomain . BaseDirectory , "Data" ) ) ;
Assert . False ( l . ExistsPlaylist ( new Playlist ( name , desc , imageURL ) ) ) ;
Assert . False ( l . ExistsPlaylistByName ( name ) ) ;
}
[Theory]
[InlineData("Trajectoire", "morceau1.png", "Sortie : 2020", "path.mp3")]
[InlineData("Bones", "album14.jpg", "Titre de l'album Mercury Act 2", "path.mp3")]
public void TU_ExistsCustomTitle_Method ( string name , string imageURL , string info , string path )
{
LinqXmlSerialization l = new ( Path . Combine ( AppDomain . CurrentDomain . BaseDirectory , "Data" ) ) ;
Assert . False ( l . ExistsCustomTitle ( new CustomTitle ( name , imageURL , info , path ) ) ) ;
Assert . False ( l . ExistsCustomTitleByName ( name ) ) ;
}
}
}