|
|
|
@ -109,6 +109,167 @@ namespace TestUnitaires
|
|
|
|
|
Assert.False(l.ExistsCustomTitle(new CustomTitle(name, imageURL, info, path)));
|
|
|
|
|
Assert.False(l.ExistsCustomTitleByName(name));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void TU_RemoveAddMultiple()
|
|
|
|
|
{
|
|
|
|
|
List<Album> albums = new()
|
|
|
|
|
{
|
|
|
|
|
new Album("album1", "img1.png", new Artist("artist"), "desc", "info"),
|
|
|
|
|
new Album("album2", "img2.png", new Artist("artist"), "desc", "info"),
|
|
|
|
|
new Album("album3", "img3.png", new Artist("artist"), "desc", "info")
|
|
|
|
|
};
|
|
|
|
|
List<Artist> artists = new()
|
|
|
|
|
{
|
|
|
|
|
new Artist("artist1"),
|
|
|
|
|
new Artist("artist2"),
|
|
|
|
|
new Artist("artist3")
|
|
|
|
|
};
|
|
|
|
|
List<InfoTitle> infoTitles = new()
|
|
|
|
|
{
|
|
|
|
|
new InfoTitle("it1", "img1.png", "desc", "info", Genre.POP, 0),
|
|
|
|
|
new InfoTitle("it2", "img2.png", "desc", "info", Genre.POP, 0),
|
|
|
|
|
new InfoTitle("it3", "img3.png", "desc", "info", Genre.POP, 0)
|
|
|
|
|
};
|
|
|
|
|
List<CustomTitle> customTitles = new()
|
|
|
|
|
{
|
|
|
|
|
new CustomTitle("ct1", "img1.png", "info", "path1.mp3"),
|
|
|
|
|
new CustomTitle("ct2", "img2.png", "info", "path2.mp3"),
|
|
|
|
|
new CustomTitle("ct3", "img3.png", "info", "path3.mp3")
|
|
|
|
|
};
|
|
|
|
|
List<Playlist> playlists = new()
|
|
|
|
|
{
|
|
|
|
|
new Playlist("nom1", "desc", "img1.png"),
|
|
|
|
|
new Playlist("nom2", "desc", "img2.png"),
|
|
|
|
|
new Playlist("nom3", "desc", "img3.png")
|
|
|
|
|
};
|
|
|
|
|
LinqXmlSerialization l = new(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data"));
|
|
|
|
|
l.AddAlbums(albums);
|
|
|
|
|
l.AddArtists(artists);
|
|
|
|
|
l.AddInfoTitles(infoTitles);
|
|
|
|
|
l.AddCustomTitles(customTitles);
|
|
|
|
|
l.AddPlaylists(playlists);
|
|
|
|
|
|
|
|
|
|
l.RemoveAlbums(albums);
|
|
|
|
|
l.RemoveArtists(artists);
|
|
|
|
|
l.RemoveInfoTitles(infoTitles);
|
|
|
|
|
l.RemoveCustomTitles(customTitles);
|
|
|
|
|
l.RemovePlaylists(playlists);
|
|
|
|
|
|
|
|
|
|
l.AddAlbums(albums);
|
|
|
|
|
l.AddArtists(artists);
|
|
|
|
|
l.AddInfoTitles(infoTitles);
|
|
|
|
|
l.AddCustomTitles(customTitles);
|
|
|
|
|
l.AddPlaylists(playlists);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Theory]
|
|
|
|
|
[InlineData("nom", "url2.png", "artist", "desc", "info", Genre.POP, "path.mp3")]
|
|
|
|
|
[InlineData("nom", "url2.png", "", "desc", "info", Genre.POP, "path.mp3")]
|
|
|
|
|
[InlineData("nom", "url2.png", "artist", "", "info", Genre.POP, "path.mp3")]
|
|
|
|
|
[InlineData("nom", "url2.png", "artist", "desc", "", Genre.POP, "path.mp3")]
|
|
|
|
|
[InlineData("nom", "url2.png", "artist", "desc", "", Genre.POP, "")]
|
|
|
|
|
public void TU_Update(string nom, string url, string artistName, string description, string info, Genre genre, string path)
|
|
|
|
|
{
|
|
|
|
|
LinqXmlSerialization l = new(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data"));
|
|
|
|
|
|
|
|
|
|
Album album = new("album1", "img1.png", new Artist("artist1"), "desc", "info");
|
|
|
|
|
Album album2 = new("album2", "img2.png", new Artist("artist1"), "desc", "info");
|
|
|
|
|
|
|
|
|
|
Artist artist = new("artist1");
|
|
|
|
|
Artist artist2 = new("artist2");
|
|
|
|
|
|
|
|
|
|
InfoTitle infoTitle = new("it1", "img1.png", "desc", "info", Genre.RAP, 0);
|
|
|
|
|
InfoTitle infoTitle2 = new("it12", "img12.png", "desc", "info", Genre.RAP, 0);
|
|
|
|
|
|
|
|
|
|
CustomTitle customTitle = new("nom1", "img1.png", "info", "path1.mp3");
|
|
|
|
|
CustomTitle customTitle2 = new("nom2", "img2.png", "info", "path2.mp3");
|
|
|
|
|
|
|
|
|
|
Playlist playlist = new("nom1", "desc", "img1.png");
|
|
|
|
|
Playlist playlist2 = new("nom2", "desc", "img2.png");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
l.AddAlbum(album);
|
|
|
|
|
l.AddAlbum(album2);
|
|
|
|
|
l.AddArtist(artist);
|
|
|
|
|
l.AddArtist(artist2);
|
|
|
|
|
l.AddInfoTitle(infoTitle);
|
|
|
|
|
l.AddInfoTitle(infoTitle2);
|
|
|
|
|
l.AddCustomTitle(customTitle);
|
|
|
|
|
l.AddCustomTitle(customTitle2);
|
|
|
|
|
l.AddPlaylist(playlist);
|
|
|
|
|
l.AddPlaylist(playlist2);
|
|
|
|
|
|
|
|
|
|
l.UpdateAlbum(album, nom, url, new Artist(artistName), description, info);
|
|
|
|
|
l.UpdateAlbumByName(album2.Name, nom, url, new Artist(artistName), description, info);
|
|
|
|
|
|
|
|
|
|
l.UpdateArtist(artist, nom);
|
|
|
|
|
l.UpdateArtistByName(artist2.Name, nom);
|
|
|
|
|
|
|
|
|
|
l.UpdateInfoTitle(infoTitle, nom, url, info, new Artist(artistName), description, genre);
|
|
|
|
|
l.UpdateInfoTitleByName(infoTitle2.Name, nom, url, info, new Artist(artistName), description, genre);
|
|
|
|
|
|
|
|
|
|
l.UpdateCustomTitle(customTitle, nom, url, info, path);
|
|
|
|
|
l.UpdateCustomTitleByPath(customTitle2.Path, nom, url, info, path);
|
|
|
|
|
|
|
|
|
|
l.UpdatePlaylist(playlist, nom, description, url);
|
|
|
|
|
l.UpdatePlaylistByName(playlist2.Name, nom, description, url);
|
|
|
|
|
|
|
|
|
|
List<Album> albums = new()
|
|
|
|
|
{
|
|
|
|
|
album, album2
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
List<Artist> artists = new()
|
|
|
|
|
{
|
|
|
|
|
artist, artist2
|
|
|
|
|
};
|
|
|
|
|
List<InfoTitle> infoTitles = new()
|
|
|
|
|
{
|
|
|
|
|
infoTitle, infoTitle2
|
|
|
|
|
};
|
|
|
|
|
List<CustomTitle> customTitles = new()
|
|
|
|
|
{
|
|
|
|
|
customTitle, customTitle2
|
|
|
|
|
};
|
|
|
|
|
List<Playlist> playlists = new()
|
|
|
|
|
{
|
|
|
|
|
playlist, playlist2
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
foreach(Album a in albums)
|
|
|
|
|
{
|
|
|
|
|
Assert.Equal(nom, a.Name);
|
|
|
|
|
Assert.Equal(url, a.ImageURL);
|
|
|
|
|
Assert.Equal(artistName, a.Artist.Name);
|
|
|
|
|
Assert.Equal(description, a.Description);
|
|
|
|
|
Assert.Equal(info, a.Information);
|
|
|
|
|
}
|
|
|
|
|
foreach(Artist a in artists)
|
|
|
|
|
{
|
|
|
|
|
Assert.Equal(nom, a.Name);
|
|
|
|
|
}
|
|
|
|
|
foreach(InfoTitle it in infoTitles)
|
|
|
|
|
{
|
|
|
|
|
Assert.Equal(nom, it.Name);
|
|
|
|
|
Assert.Equal(url, it.ImageURL);
|
|
|
|
|
Assert.Equal(description, it.Description);
|
|
|
|
|
Assert.Equal(info, it.Information);
|
|
|
|
|
Assert.Equal(genre, it.Genre);
|
|
|
|
|
}
|
|
|
|
|
foreach(CustomTitle ct in customTitles)
|
|
|
|
|
{
|
|
|
|
|
Assert.Equal(nom, ct.Name);
|
|
|
|
|
Assert.Equal(url, ct.ImageURL);
|
|
|
|
|
Assert.Equal(info, ct.Information);
|
|
|
|
|
Assert.Equal(path, ct.Path);
|
|
|
|
|
}
|
|
|
|
|
foreach(Playlist p in playlists)
|
|
|
|
|
{
|
|
|
|
|
Assert.Equal(nom, p.Name);
|
|
|
|
|
Assert.Equal(description, p.Description);
|
|
|
|
|
Assert.Equal(url, p.ImageURL);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|