|
|
|
@ -21,11 +21,6 @@ namespace TestUnitaires
|
|
|
|
|
Artist artist = new Artist(test);
|
|
|
|
|
StubManager stub = new StubManager();
|
|
|
|
|
InfoTitle info = new InfoTitle(test, "urstub.test", "infos", "desc", Genre.POP, 345);
|
|
|
|
|
/*Assert.NotEmpty(stub.Albums);
|
|
|
|
|
Assert.NotEmpty(stub.Artists);
|
|
|
|
|
Assert.NotEmpty(stub.InfoTitles);
|
|
|
|
|
Assert.NotEmpty(stub.Playlists);
|
|
|
|
|
Assert.NotEmpty(stub.CustomTitles);*/
|
|
|
|
|
stub.AddCustomTitle(t);
|
|
|
|
|
stub.AddPlaylist(p);
|
|
|
|
|
stub.AddAlbum(album);
|
|
|
|
@ -40,6 +35,7 @@ namespace TestUnitaires
|
|
|
|
|
stub.RemoveAlbum(album);
|
|
|
|
|
stub.RemoveCustomTitle(t);
|
|
|
|
|
stub.RemoveInfoTitle(info);
|
|
|
|
|
stub.RemoveArtist(artist);
|
|
|
|
|
Assert.DoesNotContain(t, stub.StubCustomTitle.CustomTitles);
|
|
|
|
|
Assert.DoesNotContain(p, stub.StubPlaylist.Playlists);
|
|
|
|
|
Assert.DoesNotContain(album, stub.StubAlbum.Albums);
|
|
|
|
@ -68,7 +64,7 @@ namespace TestUnitaires
|
|
|
|
|
Assert.True(stub.ExistsPlaylistByName(test));
|
|
|
|
|
Assert.True(stub.ExistsInfoTitleByName(test));
|
|
|
|
|
Assert.True(stub.ExistsCustomTitleByName(test));
|
|
|
|
|
/*stub.RemovePlaylist(p);
|
|
|
|
|
stub.RemovePlaylist(p);
|
|
|
|
|
stub.RemoveAlbum(album);
|
|
|
|
|
stub.RemoveCustomTitle(t);
|
|
|
|
|
stub.RemoveInfoTitle(info);
|
|
|
|
@ -82,9 +78,173 @@ namespace TestUnitaires
|
|
|
|
|
Assert.False(stub.ExistsArtistByName(test));
|
|
|
|
|
Assert.False(stub.ExistsPlaylistByName(test));
|
|
|
|
|
Assert.False(stub.ExistsInfoTitleByName(test));
|
|
|
|
|
Assert.False(stub.ExistsCustomTitleByName(test));*/
|
|
|
|
|
Assert.False(stub.ExistsCustomTitleByName(test));
|
|
|
|
|
stub.SaveSerialization();
|
|
|
|
|
stub.LoadSerialization();
|
|
|
|
|
StubManager.AddFeat(info, new Artist("artist2"));
|
|
|
|
|
stub.AddCustomTitle(t);
|
|
|
|
|
var res = stub.GetCustomTitleByPath(t.Path);
|
|
|
|
|
Assert.Equal(t, res);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void TU_RemoveAddMultiple()
|
|
|
|
|
{
|
|
|
|
|
Artist a = new("artist");
|
|
|
|
|
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")
|
|
|
|
|
};
|
|
|
|
|
StubManager stubManager = new();
|
|
|
|
|
stubManager.AddAlbums(albums);
|
|
|
|
|
stubManager.AddArtists(artists);
|
|
|
|
|
stubManager.AddInfoTitles(infoTitles);
|
|
|
|
|
stubManager.AddCustomTitles(customTitles);
|
|
|
|
|
stubManager.AddPlaylists(playlists);
|
|
|
|
|
|
|
|
|
|
stubManager.RemoveAlbums(albums);
|
|
|
|
|
stubManager.RemoveArtists(artists);
|
|
|
|
|
stubManager.RemoveInfoTitles(infoTitles);
|
|
|
|
|
stubManager.RemoveCustomTitles(customTitles);
|
|
|
|
|
stubManager.RemovePlaylists(playlists);
|
|
|
|
|
|
|
|
|
|
stubManager.AddArtist(a);
|
|
|
|
|
stubManager.RemoveArtist(a);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[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)
|
|
|
|
|
{
|
|
|
|
|
StubManager l = new();
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|