diff --git a/Sources/Model/IDataManager.cs b/Sources/Model/IDataManager.cs
index b23cc70..c983181 100644
--- a/Sources/Model/IDataManager.cs
+++ b/Sources/Model/IDataManager.cs
@@ -146,106 +146,6 @@ namespace Model
- // Update
-
- ///
- /// Modifie un objet CustomTitle avec les informations données en paramètre
- ///
- /// CustomTitle à modifier
- /// Nom de l'objet CustomTitle
- /// Chemin d'accès de l'image de l'objet CustomTitle
- /// Informations de l'objet CustomTitle
- /// Chemin d'accès de l'objet CustomTitle
- void UpdateCustomTitle(CustomTitle title, string name, string url, string info, string path);
-
- ///
- /// Modifie un objet CustomTitle avec les informations données en paramètre
- ///
- /// Chemin d'accès du CustomTitle à modifier
- /// Nom de l'objet CustomTitle
- /// Chemin d'accès de l'image de l'objet CustomTitle
- /// Informations de l'objet CustomTitle
- /// Chemin d'accès de l'objet CustomTitle
- void UpdateCustomTitleByPath(string path, string name, string newUrl, string info, string newPath);
-
- ///
- /// Modifie un objet InfoTitle avec les informations données en paramètre
- ///
- /// InfoTitle à modifier
- /// Nom de l'objet InfoTitle
- /// Chemin d'accès de l'image de l'objet InfoTitle
- /// Informations de l'objet InfoTitle
- /// Artist de l'objet InfoTitle
- /// Description de l'objet InfoTitle
- /// Genre de l'objet InfoTitle
- void UpdateInfoTitle(InfoTitle title, string name, string url, string info, Artist artist, string description, Genre genre);
-
- ///
- /// Modifie un objet InfoTitle avec les informations données en paramètre
- ///
- /// Nom de l'objet InfoTitle à modifier
- /// Chemin d'accès de l'image de l'objet InfoTitle
- /// Informations de l'objet InfoTitle
- /// Artist de l'objet InfoTitle
- /// Description de l'objet InfoTitle
- /// Genre de l'objet InfoTitle
- void UpdateInfoTitleByName(string name, string newName, string newUrl, string info, Artist artist, string description, Genre genre);
-
- ///
- /// Modifie un objet Album avec les informations données en paramètre
- ///
- /// Album à modifier
- /// Nom de l'objet Album
- /// Chemin d'accès de l'image de l'objet Album
- /// Artist de l'objet Album
- /// Description de l'objet Album
- /// Informations de l'objet Album
- void UpdateAlbum(Album album, string name, string url, Artist artist, string description, string info);
-
- ///
- /// Modifie un objet Album avec les informations données en paramètre
- ///
- /// Nom de l'objet Album à modifier
- /// Chemin d'accès de l'image de l'objet Album
- /// Artist de l'objet Album
- /// Description de l'objet Album
- /// Informations de l'objet Album
- void UpdateAlbumByName(string name, string newName, string newUrl, Artist artist, string description, string info);
-
- ///
- /// Modifie un objet Playlist avec les informations données en paramètre
- ///
- /// Playlist à modifier
- /// Nom de l'objet Playlist
- /// Description de l'objet Playlist
- /// Chemin d'accès de l'image de l'objet Playlist
- void UpdatePlaylist(Playlist playlist, string name, string description, string url);
-
- ///
- /// Modifie un objet Playlist avec les informations données en paramètre
- ///
- /// Nom de l'objet Playlist à modifier
- /// Description de l'objet Playlist
- /// Chemin d'accès de l'image de l'objet Playlist
- void UpdatePlaylistByName(string name, string newName, string description, string newUrl);
-
- ///
- /// Modifie un objet Artist avec les informations données en paramètre
- ///
- /// Artiste à modifier
- /// Nom de l'objet Artist
- void UpdateArtist(Artist artist, string name);
-
- ///
- /// Modifie un objet Artist avec les informations données en paramètre
- ///
- /// Nom de l'objet Artist à modifier
- /// Nouveau nom de l'objet Artist
- void UpdateArtistByName(string name, string newName);
-
-
-
-
// Delete
diff --git a/Sources/Model/Manager.cs b/Sources/Model/Manager.cs
index d219fc9..c568a9b 100644
--- a/Sources/Model/Manager.cs
+++ b/Sources/Model/Manager.cs
@@ -449,7 +449,10 @@ namespace Model.Stub
/// Chemin d'accès de l'objet CustomTitle
public void UpdateCustomTitle(CustomTitle title, string name, string url, string info, string path)
{
- DataManager.UpdateCustomTitle(title, name, url, info, path);
+ title.Name = name;
+ title.ImageURL = url;
+ title.Information = info;
+ title.Path = path;
}
///
@@ -462,7 +465,14 @@ namespace Model.Stub
/// Chemin d'accès de l'objet CustomTitle
public void UpdateCustomTitleByPath(string path, string name, string newUrl, string info, string newPath)
{
- DataManager.UpdateCustomTitleByPath(path, name, newUrl, info, newPath);
+ CustomTitle title = GetCustomTitleByPath(path);
+ if (title != null)
+ {
+ title.Name = name;
+ title.ImageURL = newUrl;
+ title.Information = info;
+ title.Path = newPath;
+ }
}
///
@@ -477,7 +487,11 @@ namespace Model.Stub
/// Genre de l'objet InfoTitle
public void UpdateInfoTitle(InfoTitle title, string name, string url, string info, Artist artist, string description, Genre genre)
{
- DataManager.UpdateInfoTitle(title, name, url, info, artist, description, genre);
+ title.Name = name;
+ title.ImageURL = url;
+ title.Information = info;
+ title.Description = description;
+ title.Genre = genre;
}
///
@@ -491,7 +505,15 @@ namespace Model.Stub
/// Genre de l'objet InfoTitle
public void UpdateInfoTitleByName(string name, string newName, string newUrl, string info, Artist artist, string description, Genre genre)
{
- DataManager.UpdateInfoTitleByName(name, newName, newUrl, info, artist, description, genre);
+ InfoTitle title = GetInfoTitleByName(name);
+ if (title != null)
+ {
+ title.Name = newName;
+ title.ImageURL = newUrl;
+ title.Information = info;
+ title.Description = description;
+ title.Genre = genre;
+ }
}
///
@@ -505,7 +527,11 @@ namespace Model.Stub
/// Informations de l'objet Album
public void UpdateAlbum(Album album, string name, string url, Artist artist, string description, string info)
{
- DataManager.UpdateAlbum(album, name, url, artist, description, info);
+ album.Name = name;
+ album.ImageURL = url;
+ album.Artist = artist;
+ album.Description = description;
+ album.Information = info;
}
///
@@ -518,7 +544,15 @@ namespace Model.Stub
/// Informations de l'objet Album
public void UpdateAlbumByName(string name, string newName, string newUrl, Artist artist, string description, string info)
{
- DataManager.UpdateAlbumByName(name, newName, newUrl, artist, description, info);
+ Album album = GetAlbumByName(name);
+ if (album != null)
+ {
+ album.Name = newName;
+ album.ImageURL = newUrl;
+ album.Artist = artist;
+ album.Description = description;
+ album.Information = info;
+ }
}
///
@@ -530,7 +564,9 @@ namespace Model.Stub
/// Chemin d'accès de l'image de l'objet Playlist
public void UpdatePlaylist(Playlist playlist, string name, string description, string url)
{
- DataManager.UpdatePlaylist(playlist, name, description, url);
+ playlist.Name = name;
+ playlist.Description = description;
+ playlist.ImageURL = url;
}
///
@@ -541,7 +577,13 @@ namespace Model.Stub
/// Chemin d'accès de l'image de l'objet Playlist
public void UpdatePlaylistByName(string name, string newName, string description, string newUrl)
{
- DataManager.UpdatePlaylistByName(name, newName, description, newUrl);
+ Playlist playlist = GetPlaylistByName(name);
+ if (playlist != null)
+ {
+ playlist.Name = newName;
+ playlist.Description = description;
+ playlist.ImageURL = newUrl;
+ }
}
///
@@ -551,7 +593,7 @@ namespace Model.Stub
/// Nom de l'objet Artist
public void UpdateArtist(Artist artist, string name)
{
- DataManager.UpdateArtist(artist, name);
+ artist.Name = name;
}
///
@@ -561,7 +603,11 @@ namespace Model.Stub
/// Nouveau nom de l'objet Artist
public void UpdateArtistByName(string name, string newName)
{
- DataManager.UpdateArtistByName(name, newName);
+ Artist artist = GetArtistByName(name);
+ if (artist != null)
+ {
+ artist.Name = newName;
+ }
}
///
diff --git a/Sources/Model/Serialization/LINQ_XML_Serialization.cs b/Sources/Model/Serialization/LINQ_XML_Serialization.cs
index 5b3a676..a0abfe3 100644
--- a/Sources/Model/Serialization/LINQ_XML_Serialization.cs
+++ b/Sources/Model/Serialization/LINQ_XML_Serialization.cs
@@ -592,177 +592,6 @@ namespace Model.Serialization
return playlists.FirstOrDefault(p => p.Name.Equals(name));
}
- ///
- /// Modifie un objet CustomTitle avec les informations données en paramètre
- ///
- /// CustomTitle à modifier
- /// Nom de l'objet CustomTitle
- /// Chemin d'accès de l'image de l'objet CustomTitle
- /// Informations de l'objet CustomTitle
- /// Chemin d'accès de l'objet CustomTitle
- public void UpdateCustomTitle(CustomTitle title, string name, string url, string info, string path)
- {
- title.Name = name;
- title.ImageURL = url;
- title.Information = info;
- title.Path = path;
- }
-
- ///
- /// Modifie un objet CustomTitle avec les informations données en paramètre
- ///
- /// Chemin d'accès du CustomTitle à modifier
- /// Nom de l'objet CustomTitle
- /// Chemin d'accès de l'image de l'objet CustomTitle
- /// Informations de l'objet CustomTitle
- /// Chemin d'accès de l'objet CustomTitle
- public void UpdateCustomTitleByPath(string path, string name, string newUrl, string info, string newPath)
- {
- CustomTitle title = GetCustomTitleByPath(path);
- if (title != null)
- {
- title.Name = name;
- title.ImageURL = newUrl;
- title.Information = info;
- title.Path = newPath;
- }
- }
-
- ///
- /// Modifie un objet InfoTitle avec les informations données en paramètre
- ///
- /// InfoTitle à modifier
- /// Nom de l'objet InfoTitle
- /// Chemin d'accès de l'image de l'objet InfoTitle
- /// Informations de l'objet InfoTitle
- /// Artist de l'objet InfoTitle
- /// Description de l'objet InfoTitle
- /// Genre de l'objet InfoTitle
- public void UpdateInfoTitle(InfoTitle title, string name, string url, string info, Artist artist, string description, Genre genre)
- {
- title.Name = name;
- title.ImageURL = url;
- title.Information = info;
- title.Description = description;
- title.Genre = genre;
- }
-
- ///
- /// Modifie un objet InfoTitle avec les informations données en paramètre
- ///
- /// Nom de l'objet InfoTitle à modifier
- /// Chemin d'accès de l'image de l'objet InfoTitle
- /// Informations de l'objet InfoTitle
- /// Artist de l'objet InfoTitle
- /// Description de l'objet InfoTitle
- /// Genre de l'objet InfoTitle
- public void UpdateInfoTitleByName(string name, string newName, string newUrl, string info, Artist artist, string description, Genre genre)
- {
- InfoTitle title = GetInfoTitleByName(name);
- if (title != null)
- {
- title.Name = newName;
- title.ImageURL = newUrl;
- title.Information = info;
- title.Description = description;
- title.Genre = genre;
- }
- }
-
- ///
- /// Modifie un objet Album avec les informations données en paramètre
- ///
- /// Album à modifier
- /// Nom de l'objet Album
- /// Chemin d'accès de l'image de l'objet Album
- /// Artist de l'objet Album
- /// Description de l'objet Album
- /// Informations de l'objet Album
- public void UpdateAlbum(Album album, string name, string url, Artist artist, string description, string info)
- {
- album.Name = name;
- album.ImageURL = url;
- album.Artist = artist;
- album.Description = description;
- album.Information = info;
- }
-
- ///
- /// Modifie un objet Album avec les informations données en paramètre
- ///
- /// Nom de l'objet Album à modifier
- /// Chemin d'accès de l'image de l'objet Album
- /// Artist de l'objet Album
- /// Description de l'objet Album
- /// Informations de l'objet Album
- public void UpdateAlbumByName(string name, string newName, string newUrl, Artist artist, string description, string info)
- {
- Album album = GetAlbumByName(name);
- if (album != null)
- {
- album.Name = newName;
- album.ImageURL = newUrl;
- album.Artist = artist;
- album.Description = description;
- album.Information = info;
- }
- }
-
- ///
- /// Modifie un objet Playlist avec les informations données en paramètre
- ///
- /// Playlist à modifier
- /// Nom de l'objet Playlist
- /// Description de l'objet Playlist
- /// Chemin d'accès de l'image de l'objet Playlist
- public void UpdatePlaylist(Playlist playlist, string name, string description, string url)
- {
- playlist.Name = name;
- playlist.Description = description;
- playlist.ImageURL = url;
- }
-
- ///
- /// Modifie un objet Playlist avec les informations données en paramètre
- ///
- /// Nom de l'objet Playlist à modifier
- /// Description de l'objet Playlist
- /// Chemin d'accès de l'image de l'objet Playlist
- public void UpdatePlaylistByName(string name, string newName, string description, string newUrl)
- {
- Playlist playlist = GetPlaylistByName(name);
- if (playlist != null)
- {
- playlist.Name = newName;
- playlist.Description = description;
- playlist.ImageURL = newUrl;
- }
- }
-
- ///
- /// Modifie un objet Artist avec les informations données en paramètre
- ///
- /// Artiste à modifier
- /// Nom de l'objet Artist
- public void UpdateArtist(Artist artist, string name)
- {
- artist.Name = name;
- }
-
- ///
- /// Modifie un objet Artist avec les informations données en paramètre
- ///
- /// Nom de l'objet Artist à modifier
- /// Nouveau nom de l'objet Artist
- public void UpdateArtistByName(string name, string newName)
- {
- Artist artist = GetArtistByName(name);
- if (artist != null)
- {
- artist.Name = newName;
- }
- }
-
///
/// Permet de retirer des objets Album de l'application
///
diff --git a/Sources/Model/Stub/StubManager.cs b/Sources/Model/Stub/StubManager.cs
index 896aa11..0457369 100644
--- a/Sources/Model/Stub/StubManager.cs
+++ b/Sources/Model/Stub/StubManager.cs
@@ -344,177 +344,6 @@ namespace Model.Stub
return StubPlaylist.Playlists.FirstOrDefault(p => p.Name == name);
}
- ///
- /// Modifie un objet CustomTitle avec les informations données en paramètre
- ///
- /// CustomTitle à modifier
- /// Nom de l'objet CustomTitle
- /// Chemin d'accès de l'image de l'objet CustomTitle
- /// Informations de l'objet CustomTitle
- /// Chemin d'accès de l'objet CustomTitle
- public void UpdateCustomTitle(CustomTitle title, string name, string url, string info, string path)
- {
- title.Name = name;
- title.ImageURL = url;
- title.Information = info;
- title.Path = path;
- }
-
- ///
- /// Modifie un objet CustomTitle avec les informations données en paramètre
- ///
- /// Chemin d'accès du CustomTitle à modifier
- /// Nom de l'objet CustomTitle
- /// Chemin d'accès de l'image de l'objet CustomTitle
- /// Informations de l'objet CustomTitle
- /// Chemin d'accès de l'objet CustomTitle
- public void UpdateCustomTitleByPath(string path, string name, string newUrl, string info, string newPath)
- {
- CustomTitle title = GetCustomTitleByPath(path);
- if (title != null)
- {
- title.Name = name;
- title.ImageURL = newUrl;
- title.Information = info;
- title.Path = newPath;
- }
- }
-
- ///
- /// Modifie un objet InfoTitle avec les informations données en paramètre
- ///
- /// InfoTitle à modifier
- /// Nom de l'objet InfoTitle
- /// Chemin d'accès de l'image de l'objet InfoTitle
- /// Informations de l'objet InfoTitle
- /// Artist de l'objet InfoTitle
- /// Description de l'objet InfoTitle
- /// Genre de l'objet InfoTitle
- public void UpdateInfoTitle(InfoTitle title, string name, string url, string info, Artist artist, string description, Genre genre)
- {
- title.Name = name;
- title.ImageURL = url;
- title.Information = info;
- title.Description = description;
- title.Genre = genre;
- }
-
- ///
- /// Modifie un objet InfoTitle avec les informations données en paramètre
- ///
- /// Nom de l'objet InfoTitle à modifier
- /// Chemin d'accès de l'image de l'objet InfoTitle
- /// Informations de l'objet InfoTitle
- /// Artist de l'objet InfoTitle
- /// Description de l'objet InfoTitle
- /// Genre de l'objet InfoTitle
- public void UpdateInfoTitleByName(string name, string newName, string newUrl, string info, Artist artist, string description, Genre genre)
- {
- InfoTitle title = GetInfoTitleByName(name);
- if (title != null)
- {
- title.Name = newName;
- title.ImageURL = newUrl;
- title.Information = info;
- title.Description = description;
- title.Genre = genre;
- }
- }
-
- ///
- /// Modifie un objet Album avec les informations données en paramètre
- ///
- /// Album à modifier
- /// Nom de l'objet Album
- /// Chemin d'accès de l'image de l'objet Album
- /// Artist de l'objet Album
- /// Description de l'objet Album
- /// Informations de l'objet Album
- public void UpdateAlbum(Album album, string name, string url, Artist artist, string description, string info)
- {
- album.Name = name;
- album.ImageURL = url;
- album.Artist = artist;
- album.Description = description;
- album.Information = info;
- }
-
- ///
- /// Modifie un objet Album avec les informations données en paramètre
- ///
- /// Nom de l'objet Album à modifier
- /// Chemin d'accès de l'image de l'objet Album
- /// Artist de l'objet Album
- /// Description de l'objet Album
- /// Informations de l'objet Album
- public void UpdateAlbumByName(string name, string newName, string newUrl, Artist artist, string description, string info)
- {
- Album album = GetAlbumByName(name);
- if (album != null)
- {
- album.Name = newName;
- album.ImageURL = newUrl;
- album.Artist = artist;
- album.Description = description;
- album.Information = info;
- }
- }
-
- ///
- /// Modifie un objet Playlist avec les informations données en paramètre
- ///
- /// Playlist à modifier
- /// Nom de l'objet Playlist
- /// Description de l'objet Playlist
- /// Chemin d'accès de l'image de l'objet Playlist
- public void UpdatePlaylist(Playlist playlist, string name, string description, string url)
- {
- playlist.Name = name;
- playlist.Description = description;
- playlist.ImageURL = url;
- }
-
- ///
- /// Modifie un objet Playlist avec les informations données en paramètre
- ///
- /// Nom de l'objet Playlist à modifier
- /// Description de l'objet Playlist
- /// Chemin d'accès de l'image de l'objet Playlist
- public void UpdatePlaylistByName(string name, string newName, string description, string newUrl)
- {
- Playlist playlist = GetPlaylistByName(name);
- if (playlist != null)
- {
- playlist.Name = newName;
- playlist.Description = description;
- playlist.ImageURL = newUrl;
- }
- }
-
- ///
- /// Modifie un objet Artist avec les informations données en paramètre
- ///
- /// Artiste à modifier
- /// Nom de l'objet Artist
- public void UpdateArtist(Artist artist, string name)
- {
- artist.Name = name;
- }
-
- ///
- /// Modifie un objet Artist avec les informations données en paramètre
- ///
- /// Nom de l'objet Artist à modifier
- /// Nouveau nom de l'objet Artist
- public void UpdateArtistByName(string name, string newName)
- {
- Artist artist = GetArtistByName(name);
- if (artist != null)
- {
- artist.Name = newName;
- }
- }
-
///
/// Permet de retirer des objets Album de l'application
///
diff --git a/Sources/TestUnitaires/TU_LINQ_XML_Serialization.cs b/Sources/TestUnitaires/TU_LINQ_XML_Serialization.cs
index f9f0cbe..8f125e9 100644
--- a/Sources/TestUnitaires/TU_LINQ_XML_Serialization.cs
+++ b/Sources/TestUnitaires/TU_LINQ_XML_Serialization.cs
@@ -163,115 +163,6 @@ namespace TestUnitaires
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 albums = new()
- {
- album, album2
- };
-
- List artists = new()
- {
- artist, artist2
- };
- List infoTitles = new()
- {
- infoTitle, infoTitle2
- };
- List customTitles = new()
- {
- customTitle, customTitle2
- };
- List 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);
- }
- }
-
[Theory]
[InlineData(Genre.ROCK, "ROCK")]
[InlineData(Genre.POP, "POP")]
diff --git a/Sources/TestUnitaires/TU_Manager.cs b/Sources/TestUnitaires/TU_Manager.cs
index 6a6fa8d..daeb7bb 100644
--- a/Sources/TestUnitaires/TU_Manager.cs
+++ b/Sources/TestUnitaires/TU_Manager.cs
@@ -4,6 +4,7 @@ using Model.Stub;
using Newtonsoft.Json.Linq;
using NuGet.Frameworks;
using System;
+using System.IO;
namespace TestUnitaires
{
@@ -111,6 +112,115 @@ namespace TestUnitaires
p.AddTitle(t);
m.RemoveCustomTitleFromPlaylists(t);
Assert.DoesNotContain(t, p.Titles);
+
+ }
+
+ [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)
+ {
+ 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");
+
+ 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);
+
+ m.UpdateAlbum(album, nom, url, new Artist(artistName), description, info);
+ m.UpdateAlbumByName(album2.Name, nom, url, new Artist(artistName), description, info);
+
+ m.UpdateArtist(artist, nom);
+ m.UpdateArtistByName(artist2.Name, nom);
+
+ m.UpdateInfoTitle(infoTitle, nom, url, info, new Artist(artistName), description, genre);
+ m.UpdateInfoTitleByName(infoTitle2.Name, nom, url, info, new Artist(artistName), description, genre);
+
+ m.UpdateCustomTitle(customTitle, nom, url, info, path);
+ m.UpdateCustomTitleByPath(customTitle2.Path, nom, url, info, path);
+
+ m.UpdatePlaylist(playlist, nom, description, url);
+ m.UpdatePlaylistByName(playlist2.Name, nom, description, url);
+
+ List albums = new()
+ {
+ album, album2
+ };
+
+ List artists = new()
+ {
+ artist, artist2
+ };
+ List infoTitles = new()
+ {
+ infoTitle, infoTitle2
+ };
+ List customTitles = new()
+ {
+ customTitle, customTitle2
+ };
+ List 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);
+ }
}
}
diff --git a/Sources/TestUnitaires/TU_StubManager.cs b/Sources/TestUnitaires/TU_StubManager.cs
index e09a4db..5c18bd7 100644
--- a/Sources/TestUnitaires/TU_StubManager.cs
+++ b/Sources/TestUnitaires/TU_StubManager.cs
@@ -137,115 +137,6 @@ namespace TestUnitaires
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 albums = new()
- {
- album, album2
- };
-
- List artists = new()
- {
- artist, artist2
- };
- List infoTitles = new()
- {
- infoTitle, infoTitle2
- };
- List customTitles = new()
- {
- customTitle, customTitle2
- };
- List 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);
- }
- }
}
}
\ No newline at end of file