|
|
|
@ -116,10 +116,6 @@ namespace TestUnitaires
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[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)
|
|
|
|
|
{
|
|
|
|
@ -138,95 +134,89 @@ namespace TestUnitaires
|
|
|
|
|
Playlist playlist = new("nom1", "desc", "img1.png");
|
|
|
|
|
Playlist playlist2 = new("nom2", "desc", "img2.png");
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
Manager m = new(new LinqXmlSerialization(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data")));
|
|
|
|
|
Manager m = new(new LinqXmlSerialization(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data")));
|
|
|
|
|
|
|
|
|
|
m.AddAlbum(album);
|
|
|
|
|
m.AddAlbum(album2);
|
|
|
|
|
m.AddArtist(artist);
|
|
|
|
|
m.AddArtist(artist2);
|
|
|
|
|
m.AddInfoTitle(infoTitle);
|
|
|
|
|
m.AddInfoTitle(infoTitle2);
|
|
|
|
|
m.AddCustomTitle(customTitle);
|
|
|
|
|
m.AddCustomTitle(customTitle2);
|
|
|
|
|
m.AddPlaylist(playlist);
|
|
|
|
|
m.AddPlaylist(playlist2);
|
|
|
|
|
|
|
|
|
|
Manager.UpdateAlbum(album, nom, url, new Artist(artistName), description, info);
|
|
|
|
|
m.UpdateAlbumByName(album2.Name, nom, url, new Artist(artistName), description, info);
|
|
|
|
|
|
|
|
|
|
Manager.UpdateArtist(artist, nom);
|
|
|
|
|
m.UpdateArtistByName(artist2.Name, nom);
|
|
|
|
|
|
|
|
|
|
Manager.UpdateInfoTitle(infoTitle, nom, url, info, new Artist(artistName), description, genre);
|
|
|
|
|
m.UpdateInfoTitleByName(infoTitle2.Name, nom, url, info, new Artist(artistName), description, genre);
|
|
|
|
|
|
|
|
|
|
Manager.UpdateCustomTitle(customTitle, nom, url, info, path);
|
|
|
|
|
m.UpdateCustomTitleByPath(customTitle2.Path, nom, url, info, path);
|
|
|
|
|
|
|
|
|
|
Manager.UpdatePlaylist(playlist, nom, description, url);
|
|
|
|
|
m.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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
m.AddAlbum(album);
|
|
|
|
|
m.AddAlbum(album2);
|
|
|
|
|
m.AddArtist(artist);
|
|
|
|
|
m.AddArtist(artist2);
|
|
|
|
|
m.AddInfoTitle(infoTitle);
|
|
|
|
|
m.AddInfoTitle(infoTitle2);
|
|
|
|
|
m.AddCustomTitle(customTitle);
|
|
|
|
|
m.AddCustomTitle(customTitle2);
|
|
|
|
|
m.AddPlaylist(playlist);
|
|
|
|
|
m.AddPlaylist(playlist2);
|
|
|
|
|
|
|
|
|
|
Manager.UpdateAlbum(album, nom, url, new Artist(artistName), description, info);
|
|
|
|
|
m.UpdateAlbumByName(album2.Name, nom, url, new Artist(artistName), description, info);
|
|
|
|
|
|
|
|
|
|
Manager.UpdateArtist(artist, nom);
|
|
|
|
|
m.UpdateArtistByName(artist2.Name, nom);
|
|
|
|
|
|
|
|
|
|
Manager.UpdateInfoTitle(infoTitle, nom, url, info, new Artist(artistName), description, genre);
|
|
|
|
|
m.UpdateInfoTitleByName(infoTitle2.Name, nom, url, info, new Artist(artistName), description, genre);
|
|
|
|
|
|
|
|
|
|
Manager.UpdateCustomTitle(customTitle, nom, url, info, path);
|
|
|
|
|
m.UpdateCustomTitleByPath(customTitle2.Path, nom, url, info, path);
|
|
|
|
|
|
|
|
|
|
Manager.UpdatePlaylist(playlist, nom, description, url);
|
|
|
|
|
m.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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|