From 789091187f6826bab7fe518a7d36029d03bd41f0 Mon Sep 17 00:00:00 2001 From: HMatheo Date: Wed, 7 Jun 2023 20:00:24 +0200 Subject: [PATCH 01/15] Added JSON DataContract --- MangaMap/App.xaml.cs | 6 ++- MangaMap/Stub/DataContractJSON.cs | 78 +++++++++++++++++++++++++++++ MangaMap/Stub/DataContractXML.cs | 82 +++++++++++++++++++++++++++++++ 3 files changed, 164 insertions(+), 2 deletions(-) create mode 100644 MangaMap/Stub/DataContractJSON.cs create mode 100644 MangaMap/Stub/DataContractXML.cs diff --git a/MangaMap/App.xaml.cs b/MangaMap/App.xaml.cs index a13dace..902c919 100644 --- a/MangaMap/App.xaml.cs +++ b/MangaMap/App.xaml.cs @@ -38,7 +38,8 @@ public partial class App : Application if (File.Exists(Path.Combine(FilePath, FileName))) { - MyManager = new Manager(new Stub.DataContract()); // Utilise le DataContract comme moyen de persistance. + MyManager = new Manager(new Stub.DataContractXML()); // Utilise le DataContract comme moyen de persistance. + //MyManager = new Manager(new Stub.DataContractJSON()); // Utilise le DataContract comme moyen de persistance. } MyManager.charger(); @@ -48,7 +49,8 @@ public partial class App : Application if (!File.Exists(Path.Combine(FilePath, FileName))) { - MyManager.Persistance = new DataContract(); // Utilise le Stub comme moyen de persistance. + MyManager.Persistance = new DataContractXML(); // Utilise le Stub comme moyen de persistance. + //MyManager = new Manager(new Stub.DataContractJSON()); } MyManager.sauvegarder(); diff --git a/MangaMap/Stub/DataContractJSON.cs b/MangaMap/Stub/DataContractJSON.cs new file mode 100644 index 0000000..1adf76b --- /dev/null +++ b/MangaMap/Stub/DataContractJSON.cs @@ -0,0 +1,78 @@ +using MangaMap.Model; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.Linq; +using System.Runtime.Serialization.Json; +using System.Text; +using System.Threading.Tasks; + +namespace MangaMap.Stub +{ + /// + /// Implémentation de l'interface IPersistanceManager utilisant la sérialisation avec DataContract. + /// + public class DataContractJSON : IPersistanceManager + { + /// + /// Obtient ou définit le nom du fichier de sauvegarde JSON. + /// + public string FileName { get; set; } = "SauvegardeDonnees.json"; + + /// + /// Obtient ou définit le chemin du fichier de sauvegarde JSON. + /// + public string FilePath { get; set; } = Path.Combine(AppDomain.CurrentDomain.BaseDirectory); + + /// + /// Charge les données sauvegardées à partir du fichier JSON. + /// + /// Un tuple contenant la liste des oeuvres et la liste des utilisateurs. + public (ObservableCollection, List) chargeDonne() + { + DataContractJsonSerializer jsonSerializer = new DataContractJsonSerializer(typeof(DataToPersist)); + + DataToPersist data; + + using (FileStream stream2 = File.OpenRead(Path.Combine(FilePath, FileName))) + { + data = jsonSerializer.ReadObject(stream2) as DataToPersist; + } + + return (data.Oeuvres, data.Utilisateurs); + } + + /// + /// Sauvegarde les données dans le fichier JSON. + /// + /// La liste des oeuvres à sauvegarder. + /// La liste des utilisateurs à sauvegarder. + public void sauvegarder(ObservableCollection o, List u) + { + DataToPersist data = new DataToPersist(); + data.Oeuvres = o; + data.Utilisateurs = u; + + if (!Directory.Exists(FilePath)) + { + Debug.WriteLine("Directory doesn't exist."); + Directory.CreateDirectory(FilePath); + } + + DataContractJsonSerializer jsonSerializer = new DataContractJsonSerializer(typeof(DataToPersist)); + using (FileStream stream = File.Create(Path.Combine(FilePath, FileName))) + { + using (var writer = JsonReaderWriterFactory.CreateJsonWriter( + stream, + System.Text.Encoding.UTF8, + false, + true))//<- this boolean says that we sant indentation + { + jsonSerializer.WriteObject(writer, data); + writer.Flush(); + } + } + } + } +} diff --git a/MangaMap/Stub/DataContractXML.cs b/MangaMap/Stub/DataContractXML.cs new file mode 100644 index 0000000..34df3bc --- /dev/null +++ b/MangaMap/Stub/DataContractXML.cs @@ -0,0 +1,82 @@ +using MangaMap.Model; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; +using System.Xml; + +namespace MangaMap.Stub +{ + /// + /// Implémentation de l'interface IPersistanceManager utilisant la sérialisation avec DataContract. + /// + public class DataContractXML : IPersistanceManager + { + /// + /// Obtient ou définit le nom du fichier de sauvegarde XML. + /// + public string FileName { get; set; } = "SauvegardeDonnees.xml"; + + /// + /// Obtient ou définit le chemin du fichier de sauvegarde xml. + /// + public string FilePath { get; set; } = Path.Combine(AppDomain.CurrentDomain.BaseDirectory); + + /// + /// Charge les données sauvegardées à partir du fichier xml. + /// + /// Un tuple contenant la liste des oeuvres et la liste des utilisateurs. + public (ObservableCollection, List) chargeDonne() + { + var serializer = new DataContractSerializer(typeof(DataToPersist)); + DataToPersist data; + + if (File.Exists(Path.Combine(FilePath, FileName))) // Vérifiez si le fichier existe + { + using (Stream s = File.OpenRead(Path.Combine(FilePath, FileName))) + { + data = serializer.ReadObject(s) as DataToPersist; + } + } + else + { + data = new DataToPersist(); // Si le fichier n'existe pas, créez une nouvelle liste + } + + return (data.Oeuvres, data.Utilisateurs); + } + + /// + /// Sauvegarde les données dans le fichier XML. + /// + /// La liste des oeuvres à sauvegarder. + /// La liste des utilisateurs à sauvegarder. + public void sauvegarder(ObservableCollection o, List u) + { + var serializer = new DataContractSerializer(typeof(DataToPersist)); + + if (!Directory.Exists(FilePath)) + { + Debug.WriteLine("Directory doesn't exist."); + Directory.CreateDirectory(FilePath); + } + + DataToPersist data = new DataToPersist(); + data.Oeuvres = o; + data.Utilisateurs = u; + + var settings = new XmlWriterSettings() { Indent = true }; + using (TextWriter tw = File.CreateText(Path.Combine(FilePath, FileName))) + { + using (XmlWriter w = XmlWriter.Create(tw, settings)) + { + serializer.WriteObject(w, data); // Version d'enregistrement des données avec indentation. + } + } + } + } +} From 2407381f1c7abdfce1b47cc0d68b5dab8b830d80 Mon Sep 17 00:00:00 2001 From: Matheo HERSAN Date: Thu, 8 Jun 2023 14:15:25 +0200 Subject: [PATCH 02/15] Change architecture --- MangaMap/App.xaml.cs | 5 +++-- MangaMap/CustomHeader.xaml.cs | 2 +- MangaMap/MangaMap.csproj | 12 ++++++++--- MangaMap/MangaMap.sln | 6 ++++++ MangaMap/Stub/DataContract.cs | 2 +- MangaMap/Stub/DataContractJSON.cs | 2 +- MangaMap/Stub/DataContractXML.cs | 2 +- MangaMap/Stub/DataToPersist.cs | 2 +- MangaMap/Stub/Stub.cs | 2 +- MangaMap/Views/Composants/ListOeuvre.xaml.cs | 2 +- MangaMap/Views/Composants/StyleBouton.xaml.cs | 2 +- MangaMap/Views/CreateOeuvre.xaml.cs | 2 +- MangaMap/Views/FicheAnime.xaml.cs | 2 +- MangaMap/Views/homePage.xaml | 2 +- MangaMap/Views/homePage.xaml.cs | 2 +- MangaMap/Views/listPage.xaml.cs | 2 +- MangaMap/Views/loginAdminPage.xaml.cs | 2 +- MangaMap/Views/loginPage.xaml.cs | 2 +- MangaMap/Views/settingsPage.xaml.cs | 2 +- MangaMap/Views/signUpPage.xaml.cs | 2 +- {MangaMap/Model => Models}/Admin.cs | 5 ++--- .../Stub => Models}/IPersistanceManager.cs | 3 +-- {MangaMap/Model => Models}/Liste.cs | 5 ++--- {MangaMap/Model => Models}/Manager.cs | 20 ++----------------- Models/Models.csproj | 9 +++++++++ {MangaMap/Model => Models}/Oeuvre.cs | 4 ++-- {MangaMap/Model => Models}/Personne.cs | 8 ++++---- {MangaMap/Model => Models}/Utilisateur.cs | 6 +++--- 28 files changed, 60 insertions(+), 57 deletions(-) rename {MangaMap/Model => Models}/Admin.cs (91%) rename {MangaMap/Stub => Models}/IPersistanceManager.cs (92%) rename {MangaMap/Model => Models}/Liste.cs (79%) rename {MangaMap/Model => Models}/Manager.cs (82%) create mode 100644 Models/Models.csproj rename {MangaMap/Model => Models}/Oeuvre.cs (97%) rename {MangaMap/Model => Models}/Personne.cs (94%) rename {MangaMap/Model => Models}/Utilisateur.cs (94%) diff --git a/MangaMap/App.xaml.cs b/MangaMap/App.xaml.cs index 902c919..e7f4845 100644 --- a/MangaMap/App.xaml.cs +++ b/MangaMap/App.xaml.cs @@ -1,6 +1,7 @@ -using MangaMap.Model; +using Models; using MangaMap.Stub; using MangaMap.Views; +using System.Diagnostics; namespace MangaMap; @@ -49,7 +50,7 @@ public partial class App : Application if (!File.Exists(Path.Combine(FilePath, FileName))) { - MyManager.Persistance = new DataContractXML(); // Utilise le Stub comme moyen de persistance. + MyManager.Persistance = new Stub.DataContractXML(); // Utilise le Stub comme moyen de persistance. //MyManager = new Manager(new Stub.DataContractJSON()); } diff --git a/MangaMap/CustomHeader.xaml.cs b/MangaMap/CustomHeader.xaml.cs index f62f384..c845dda 100644 --- a/MangaMap/CustomHeader.xaml.cs +++ b/MangaMap/CustomHeader.xaml.cs @@ -1,6 +1,6 @@ using MangaMap.Views; namespace MangaMap; -using MangaMap.Model; +using Models; using System.ComponentModel; using INotifyPropertyChanged = System.ComponentModel.INotifyPropertyChanged; diff --git a/MangaMap/MangaMap.csproj b/MangaMap/MangaMap.csproj index d4b88f9..d11847b 100644 --- a/MangaMap/MangaMap.csproj +++ b/MangaMap/MangaMap.csproj @@ -1,11 +1,11 @@  - net7.0; + net7.0-android;net7.0-ios;net7.0-maccatalyst $(TargetFrameworks);net7.0-windows10.0.19041.0 - Exe + Exe MangaMap true true @@ -50,11 +50,17 @@ + + + + + + @@ -129,7 +135,7 @@ - + \ No newline at end of file diff --git a/MangaMap/MangaMap.sln b/MangaMap/MangaMap.sln index c199b28..499c747 100644 --- a/MangaMap/MangaMap.sln +++ b/MangaMap/MangaMap.sln @@ -5,6 +5,8 @@ VisualStudioVersion = 17.0.31611.283 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MangaMap", "MangaMap.csproj", "{1946288E-37BA-420F-89BD-A1C3D4178344}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Models", "..\Models\Models.csproj", "{D13B26C4-A575-4577-A735-0B04DC02BC85}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -17,6 +19,10 @@ Global {1946288E-37BA-420F-89BD-A1C3D4178344}.Release|Any CPU.ActiveCfg = Release|Any CPU {1946288E-37BA-420F-89BD-A1C3D4178344}.Release|Any CPU.Build.0 = Release|Any CPU {1946288E-37BA-420F-89BD-A1C3D4178344}.Release|Any CPU.Deploy.0 = Release|Any CPU + {D13B26C4-A575-4577-A735-0B04DC02BC85}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D13B26C4-A575-4577-A735-0B04DC02BC85}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D13B26C4-A575-4577-A735-0B04DC02BC85}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D13B26C4-A575-4577-A735-0B04DC02BC85}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/MangaMap/Stub/DataContract.cs b/MangaMap/Stub/DataContract.cs index 1f3ba71..2c5f255 100644 --- a/MangaMap/Stub/DataContract.cs +++ b/MangaMap/Stub/DataContract.cs @@ -1,4 +1,4 @@ -using MangaMap.Model; +using Models; using System; using System.Collections.Generic; using System.Collections.ObjectModel; diff --git a/MangaMap/Stub/DataContractJSON.cs b/MangaMap/Stub/DataContractJSON.cs index 1adf76b..617f310 100644 --- a/MangaMap/Stub/DataContractJSON.cs +++ b/MangaMap/Stub/DataContractJSON.cs @@ -1,4 +1,4 @@ -using MangaMap.Model; +using Models; using System; using System.Collections.Generic; using System.Collections.ObjectModel; diff --git a/MangaMap/Stub/DataContractXML.cs b/MangaMap/Stub/DataContractXML.cs index 34df3bc..2def370 100644 --- a/MangaMap/Stub/DataContractXML.cs +++ b/MangaMap/Stub/DataContractXML.cs @@ -1,4 +1,4 @@ -using MangaMap.Model; +using Models; using System; using System.Collections.Generic; using System.Collections.ObjectModel; diff --git a/MangaMap/Stub/DataToPersist.cs b/MangaMap/Stub/DataToPersist.cs index 0f30580..6f79fb1 100644 --- a/MangaMap/Stub/DataToPersist.cs +++ b/MangaMap/Stub/DataToPersist.cs @@ -1,5 +1,5 @@ using System; -using MangaMap.Model; +using Models; using System.Collections.Generic; using System.Linq; using System.Text; diff --git a/MangaMap/Stub/Stub.cs b/MangaMap/Stub/Stub.cs index db3f7b3..bb6327a 100644 --- a/MangaMap/Stub/Stub.cs +++ b/MangaMap/Stub/Stub.cs @@ -1,4 +1,4 @@ -using MangaMap.Model; +using Models; using System; using System.Collections.Generic; using System.Collections.ObjectModel; diff --git a/MangaMap/Views/Composants/ListOeuvre.xaml.cs b/MangaMap/Views/Composants/ListOeuvre.xaml.cs index 9c8d065..72a153e 100644 --- a/MangaMap/Views/Composants/ListOeuvre.xaml.cs +++ b/MangaMap/Views/Composants/ListOeuvre.xaml.cs @@ -1,5 +1,5 @@ namespace MangaMap.Views.Composants; -using MangaMap.Model; +using Models; using System.Xml; public partial class ListOeuvre : ContentView diff --git a/MangaMap/Views/Composants/StyleBouton.xaml.cs b/MangaMap/Views/Composants/StyleBouton.xaml.cs index 9ae2237..e22327b 100644 --- a/MangaMap/Views/Composants/StyleBouton.xaml.cs +++ b/MangaMap/Views/Composants/StyleBouton.xaml.cs @@ -1,4 +1,4 @@ -using MangaMap.Model; +using Models; namespace MangaMap.Views.Composants { diff --git a/MangaMap/Views/CreateOeuvre.xaml.cs b/MangaMap/Views/CreateOeuvre.xaml.cs index 4fa4d98..9aec412 100644 --- a/MangaMap/Views/CreateOeuvre.xaml.cs +++ b/MangaMap/Views/CreateOeuvre.xaml.cs @@ -1,5 +1,5 @@ using System.Text.RegularExpressions; -using MangaMap.Model; +using Models; using static System.Runtime.InteropServices.JavaScript.JSType; using System.Threading.Tasks; using Microsoft.Maui.Storage; diff --git a/MangaMap/Views/FicheAnime.xaml.cs b/MangaMap/Views/FicheAnime.xaml.cs index ab40e22..8564ae1 100644 --- a/MangaMap/Views/FicheAnime.xaml.cs +++ b/MangaMap/Views/FicheAnime.xaml.cs @@ -1,6 +1,6 @@ namespace MangaMap.Views { - using Model; + using Models; using System.ComponentModel; using System.Diagnostics; using System.Drawing; diff --git a/MangaMap/Views/homePage.xaml b/MangaMap/Views/homePage.xaml index e2f52b9..ec60997 100644 --- a/MangaMap/Views/homePage.xaml +++ b/MangaMap/Views/homePage.xaml @@ -2,7 +2,7 @@ diff --git a/MangaMap/Views/homePage.xaml.cs b/MangaMap/Views/homePage.xaml.cs index 8cdc9c4..86f369e 100644 --- a/MangaMap/Views/homePage.xaml.cs +++ b/MangaMap/Views/homePage.xaml.cs @@ -1,6 +1,6 @@ namespace MangaMap.Views { - using MangaMap.Model; + using Models; using System.Collections.ObjectModel; /// diff --git a/MangaMap/Views/listPage.xaml.cs b/MangaMap/Views/listPage.xaml.cs index 2a5ed04..a64e75e 100644 --- a/MangaMap/Views/listPage.xaml.cs +++ b/MangaMap/Views/listPage.xaml.cs @@ -1,5 +1,5 @@ namespace MangaMap.Views; -using MangaMap.Model; +using Models; using static System.Net.Mime.MediaTypeNames; diff --git a/MangaMap/Views/loginAdminPage.xaml.cs b/MangaMap/Views/loginAdminPage.xaml.cs index bd4f519..fe55a2d 100644 --- a/MangaMap/Views/loginAdminPage.xaml.cs +++ b/MangaMap/Views/loginAdminPage.xaml.cs @@ -2,7 +2,7 @@ namespace MangaMap.Views; using System.Text.RegularExpressions; using System.Threading.Tasks; using MangaMap.Stub; -using MangaMap.Model; +using Models; /// /// Classe représentant la page de connexion administrateur de l'application. diff --git a/MangaMap/Views/loginPage.xaml.cs b/MangaMap/Views/loginPage.xaml.cs index ac3565c..0253dd9 100644 --- a/MangaMap/Views/loginPage.xaml.cs +++ b/MangaMap/Views/loginPage.xaml.cs @@ -2,7 +2,7 @@ namespace MangaMap.Views; using System.Text.RegularExpressions; using System.Threading.Tasks; using MangaMap.Stub; -using MangaMap.Model; +using Models; /// /// Classe représentant la page de connexion de l'application. diff --git a/MangaMap/Views/settingsPage.xaml.cs b/MangaMap/Views/settingsPage.xaml.cs index 6d007c7..bbbdc24 100644 --- a/MangaMap/Views/settingsPage.xaml.cs +++ b/MangaMap/Views/settingsPage.xaml.cs @@ -1,5 +1,5 @@ namespace MangaMap.Views; -using Model; +using Models; /// /// Classe représentant la page des paramètres de l'application. diff --git a/MangaMap/Views/signUpPage.xaml.cs b/MangaMap/Views/signUpPage.xaml.cs index 8c87c23..180473a 100644 --- a/MangaMap/Views/signUpPage.xaml.cs +++ b/MangaMap/Views/signUpPage.xaml.cs @@ -1,6 +1,6 @@ namespace MangaMap.Views; -using MangaMap.Model; +using Models; using System.Text.RegularExpressions; using static System.Runtime.InteropServices.JavaScript.JSType; diff --git a/MangaMap/Model/Admin.cs b/Models/Admin.cs similarity index 91% rename from MangaMap/Model/Admin.cs rename to Models/Admin.cs index a78ef54..56f0154 100644 --- a/MangaMap/Model/Admin.cs +++ b/Models/Admin.cs @@ -1,11 +1,10 @@ -using MangaMap.Views; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -namespace MangaMap.Model +namespace Models { /// /// Représente un administrateur dans le système de gestion de listes d'anime. diff --git a/MangaMap/Stub/IPersistanceManager.cs b/Models/IPersistanceManager.cs similarity index 92% rename from MangaMap/Stub/IPersistanceManager.cs rename to Models/IPersistanceManager.cs index 784f4a6..54288d8 100644 --- a/MangaMap/Stub/IPersistanceManager.cs +++ b/Models/IPersistanceManager.cs @@ -4,9 +4,8 @@ using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; -using MangaMap.Model; -namespace MangaMap.Stub +namespace Models { /// /// Interface pour la gestion de la persistance des données. diff --git a/MangaMap/Model/Liste.cs b/Models/Liste.cs similarity index 79% rename from MangaMap/Model/Liste.cs rename to Models/Liste.cs index 81d04f8..6b532d2 100644 --- a/MangaMap/Model/Liste.cs +++ b/Models/Liste.cs @@ -1,17 +1,16 @@ using System; -using MangaMap.Model; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; -namespace MangaMap.Model +namespace Models { class Liste { public string Nom { get; private set; } public int NbAnime { get; private set; } - public Oeuvre[] AnimeListe { get; private set; } + public Oeuvre[]? AnimeListe { get; private set; } public Liste(string nom, int nbAnime) { diff --git a/MangaMap/Model/Manager.cs b/Models/Manager.cs similarity index 82% rename from MangaMap/Model/Manager.cs rename to Models/Manager.cs index 095f99c..e3b508f 100644 --- a/MangaMap/Model/Manager.cs +++ b/Models/Manager.cs @@ -6,9 +6,8 @@ using System.Linq; using System.Runtime.CompilerServices; using System.Text; using System.Threading.Tasks; -using MangaMap.Stub; -namespace MangaMap.Model +namespace Models { /// /// Classe responsable de la gestion globale de l'application de gestion de listes d'anime. @@ -50,7 +49,7 @@ namespace MangaMap.Model public event PropertyChangedEventHandler? PropertyChanged; - void OnPropertyChanged([CallerMemberName] string propertyName = null) + void OnPropertyChanged([CallerMemberName] string? propertyName = null) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); /// @@ -90,21 +89,6 @@ namespace MangaMap.Model isAdmin = false; } - /*public Utilisateur charger() - { - var donnees = Persistance.chargeDonne(); - foreach (var item in donnees.Item1) - { - Oeuvres.Add(item); - } - Utilisateurs.AddRange(donnees.Item2); - - // récupérer le premier utilisateur de la liste Utilisateurs : - Utilisateur utilisateurActuel = Utilisateurs.FirstOrDefault(); - - return utilisateurActuel; // Renvoyez l'utilisateur actuel - }*/ - /// /// Charge les données de l'application à partir du gestionnaire de persistance. /// diff --git a/Models/Models.csproj b/Models/Models.csproj new file mode 100644 index 0000000..4658cbf --- /dev/null +++ b/Models/Models.csproj @@ -0,0 +1,9 @@ + + + + net7.0 + enable + enable + + + diff --git a/MangaMap/Model/Oeuvre.cs b/Models/Oeuvre.cs similarity index 97% rename from MangaMap/Model/Oeuvre.cs rename to Models/Oeuvre.cs index 877adc6..6e33fc8 100644 --- a/MangaMap/Model/Oeuvre.cs +++ b/Models/Oeuvre.cs @@ -8,7 +8,7 @@ using System.ComponentModel; using System.Xml.Linq; using System.Runtime.CompilerServices; -namespace MangaMap.Model +namespace Models { /// /// Représente une oeuvre dans le système de gestion de listes d'anime. @@ -18,7 +18,7 @@ namespace MangaMap.Model { public event PropertyChangedEventHandler? PropertyChanged; - void OnPropertyChanged([CallerMemberName] string propertyName = null) + void OnPropertyChanged([CallerMemberName] string? propertyName = null) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); /// diff --git a/MangaMap/Model/Personne.cs b/Models/Personne.cs similarity index 94% rename from MangaMap/Model/Personne.cs rename to Models/Personne.cs index 43b00d0..bc7c1da 100644 --- a/MangaMap/Model/Personne.cs +++ b/Models/Personne.cs @@ -5,7 +5,7 @@ using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; -namespace MangaMap.Model +namespace Models { /// /// Représente une personne dans le système de gestion de listes d'anime. @@ -17,19 +17,19 @@ namespace MangaMap.Model /// Obtient ou définit le mot de passe de la personne. /// [DataMember] - public string MotDePasse { get; set; } + public string? MotDePasse { get; set; } /// /// Obtient ou définit l'adresse e-mail de la personne. /// [DataMember] - public string Email { get; set; } + public string? Email { get; set; } /// /// Obtient ou définit le pseudo de la personne. /// [DataMember] - public string Pseudo { get; set; } + public string? Pseudo { get; set; } /// /// Modifie le mot de passe de la personne en vérifiant une confirmation. diff --git a/MangaMap/Model/Utilisateur.cs b/Models/Utilisateur.cs similarity index 94% rename from MangaMap/Model/Utilisateur.cs rename to Models/Utilisateur.cs index bc70eff..ca3883b 100644 --- a/MangaMap/Model/Utilisateur.cs +++ b/Models/Utilisateur.cs @@ -6,7 +6,7 @@ using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; -namespace MangaMap.Model +namespace Models { /// /// Représente un utilisateur de l'application de gestion de listes d'anime. @@ -18,13 +18,13 @@ namespace MangaMap.Model /// Obtient ou définit le nom de l'utilisateur. /// [DataMember] - public string nom { get; private set; } + public string? nom { get; private set; } /// /// Obtient ou définit le prénom de l'utilisateur. /// [DataMember] - public string prenom { get; private set; } + public string? prenom { get; private set; } /// /// Obtient ou définit l'âge de l'utilisateur. From 7ddf431e728d69bf0118d45097764646ea72ca45 Mon Sep 17 00:00:00 2001 From: Matheo HERSAN Date: Thu, 8 Jun 2023 14:22:30 +0200 Subject: [PATCH 03/15] Modif architecture --- .drone.yml | 6 +++--- {MangaMap => src/MangaMap}/App.xaml | 0 {MangaMap => src/MangaMap}/App.xaml.cs | 0 {MangaMap => src/MangaMap}/AppShell.xaml | 0 {MangaMap => src/MangaMap}/AppShell.xaml.cs | 0 {MangaMap => src/MangaMap}/CustomHeader.xaml | 0 {MangaMap => src/MangaMap}/CustomHeader.xaml.cs | 0 {MangaMap => src/MangaMap}/MainPage.xaml | 0 {MangaMap => src/MangaMap}/MainPage.xaml.cs | 0 {MangaMap => src/MangaMap}/MangaMap.csproj | 0 {MangaMap => src/MangaMap}/MangaMap.sln | 0 {MangaMap => src/MangaMap}/MauiProgram.cs | 0 .../MangaMap}/Platforms/Android/AndroidManifest.xml | 0 .../MangaMap}/Platforms/Android/MainActivity.cs | 0 .../MangaMap}/Platforms/Android/MainApplication.cs | 0 .../Platforms/Android/Resources/values/colors.xml | 0 .../MangaMap}/Platforms/MacCatalyst/AppDelegate.cs | 0 .../MangaMap}/Platforms/MacCatalyst/Info.plist | 0 .../MangaMap}/Platforms/MacCatalyst/Program.cs | 0 {MangaMap => src/MangaMap}/Platforms/Tizen/Main.cs | 0 .../MangaMap}/Platforms/Tizen/tizen-manifest.xml | 0 .../MangaMap}/Platforms/Windows/App.xaml | 0 .../MangaMap}/Platforms/Windows/App.xaml.cs | 0 .../Platforms/Windows/Package.appxmanifest | 0 .../MangaMap}/Platforms/Windows/app.manifest | 0 .../MangaMap}/Platforms/iOS/AppDelegate.cs | 0 {MangaMap => src/MangaMap}/Platforms/iOS/Info.plist | 0 {MangaMap => src/MangaMap}/Platforms/iOS/Program.cs | 0 .../MangaMap}/Properties/launchSettings.json | 0 .../MangaMap}/Resources/AppIcon/appicon.svg | 0 .../MangaMap}/Resources/AppIcon/appiconfg.svg | 0 .../MangaMap}/Resources/AppIcon/logo.png | Bin .../MangaMap}/Resources/Fonts/OpenSans-Regular.ttf | Bin .../MangaMap}/Resources/Fonts/OpenSans-Semibold.ttf | Bin .../MangaMap}/Resources/Images/account_circle.png | Bin .../MangaMap}/Resources/Images/addepisodes.png | Bin .../MangaMap}/Resources/Images/dotnet_bot.svg | 0 .../MangaMap}/Resources/Images/evangelion.jpg | Bin .../MangaMap}/Resources/Images/listbutton.png | Bin .../MangaMap}/Resources/Images/logo.png | Bin {MangaMap => src/MangaMap}/Resources/Images/ok.png | Bin .../MangaMap}/Resources/Images/onepiece.jpg | Bin .../MangaMap}/Resources/Images/oshinoko.png | Bin .../MangaMap}/Resources/Images/settings.png | Bin .../MangaMap}/Resources/Images/star_empty.svg | 0 .../MangaMap}/Resources/Images/star_full.svg | 0 .../MangaMap}/Resources/Raw/AboutAssets.txt | 0 .../MangaMap}/Resources/Splash/splash.svg | 0 .../MangaMap}/Resources/Styles/Colors.xaml | 0 .../MangaMap}/Resources/Styles/Styles.xaml | 0 .../MangaMap}/Resources/Theme/DarkTheme.xaml | 0 .../MangaMap}/Resources/Theme/DarkTheme.xaml.cs | 0 {MangaMap => src/MangaMap}/Stub/DataContract.cs | 0 {MangaMap => src/MangaMap}/Stub/DataContractJSON.cs | 0 {MangaMap => src/MangaMap}/Stub/DataContractXML.cs | 0 {MangaMap => src/MangaMap}/Stub/DataToPersist.cs | 0 {MangaMap => src/MangaMap}/Stub/Stub.cs | 0 .../MangaMap}/Views/Composants/ListOeuvre.xaml | 0 .../MangaMap}/Views/Composants/ListOeuvre.xaml.cs | 0 .../MangaMap}/Views/Composants/StyleBouton.xaml | 0 .../MangaMap}/Views/Composants/StyleBouton.xaml.cs | 0 .../MangaMap}/Views/CreateOeuvre.xaml.cs | 0 {MangaMap => src/MangaMap}/Views/FicheAnime.xaml.cs | 0 {MangaMap => src/MangaMap}/Views/createOeuvre.xaml | 0 {MangaMap => src/MangaMap}/Views/ficheAnime.xaml | 0 {MangaMap => src/MangaMap}/Views/homePage.xaml | 0 {MangaMap => src/MangaMap}/Views/homePage.xaml.cs | 0 {MangaMap => src/MangaMap}/Views/listPage.xaml | 0 {MangaMap => src/MangaMap}/Views/listPage.xaml.cs | 0 .../MangaMap}/Views/loginAdminPage.xaml | 0 .../MangaMap}/Views/loginAdminPage.xaml.cs | 0 {MangaMap => src/MangaMap}/Views/loginPage.xaml | 0 {MangaMap => src/MangaMap}/Views/loginPage.xaml.cs | 0 {MangaMap => src/MangaMap}/Views/settingsPage.xaml | 0 .../MangaMap}/Views/settingsPage.xaml.cs | 0 {MangaMap => src/MangaMap}/Views/signUpPage.xaml | 0 {MangaMap => src/MangaMap}/Views/signUpPage.xaml.cs | 0 {Models => src/Models}/Admin.cs | 0 {Models => src/Models}/IPersistanceManager.cs | 0 {Models => src/Models}/Liste.cs | 0 {Models => src/Models}/Manager.cs | 0 {Models => src/Models}/Models.csproj | 0 {Models => src/Models}/Oeuvre.cs | 0 {Models => src/Models}/Personne.cs | 0 {Models => src/Models}/Utilisateur.cs | 0 85 files changed, 3 insertions(+), 3 deletions(-) rename {MangaMap => src/MangaMap}/App.xaml (100%) rename {MangaMap => src/MangaMap}/App.xaml.cs (100%) rename {MangaMap => src/MangaMap}/AppShell.xaml (100%) rename {MangaMap => src/MangaMap}/AppShell.xaml.cs (100%) rename {MangaMap => src/MangaMap}/CustomHeader.xaml (100%) rename {MangaMap => src/MangaMap}/CustomHeader.xaml.cs (100%) rename {MangaMap => src/MangaMap}/MainPage.xaml (100%) rename {MangaMap => src/MangaMap}/MainPage.xaml.cs (100%) rename {MangaMap => src/MangaMap}/MangaMap.csproj (100%) rename {MangaMap => src/MangaMap}/MangaMap.sln (100%) rename {MangaMap => src/MangaMap}/MauiProgram.cs (100%) rename {MangaMap => src/MangaMap}/Platforms/Android/AndroidManifest.xml (100%) rename {MangaMap => src/MangaMap}/Platforms/Android/MainActivity.cs (100%) rename {MangaMap => src/MangaMap}/Platforms/Android/MainApplication.cs (100%) rename {MangaMap => src/MangaMap}/Platforms/Android/Resources/values/colors.xml (100%) rename {MangaMap => src/MangaMap}/Platforms/MacCatalyst/AppDelegate.cs (100%) rename {MangaMap => src/MangaMap}/Platforms/MacCatalyst/Info.plist (100%) rename {MangaMap => src/MangaMap}/Platforms/MacCatalyst/Program.cs (100%) rename {MangaMap => src/MangaMap}/Platforms/Tizen/Main.cs (100%) rename {MangaMap => src/MangaMap}/Platforms/Tizen/tizen-manifest.xml (100%) rename {MangaMap => src/MangaMap}/Platforms/Windows/App.xaml (100%) rename {MangaMap => src/MangaMap}/Platforms/Windows/App.xaml.cs (100%) rename {MangaMap => src/MangaMap}/Platforms/Windows/Package.appxmanifest (100%) rename {MangaMap => src/MangaMap}/Platforms/Windows/app.manifest (100%) rename {MangaMap => src/MangaMap}/Platforms/iOS/AppDelegate.cs (100%) rename {MangaMap => src/MangaMap}/Platforms/iOS/Info.plist (100%) rename {MangaMap => src/MangaMap}/Platforms/iOS/Program.cs (100%) rename {MangaMap => src/MangaMap}/Properties/launchSettings.json (100%) rename {MangaMap => src/MangaMap}/Resources/AppIcon/appicon.svg (100%) rename {MangaMap => src/MangaMap}/Resources/AppIcon/appiconfg.svg (100%) rename {MangaMap => src/MangaMap}/Resources/AppIcon/logo.png (100%) rename {MangaMap => src/MangaMap}/Resources/Fonts/OpenSans-Regular.ttf (100%) rename {MangaMap => src/MangaMap}/Resources/Fonts/OpenSans-Semibold.ttf (100%) rename {MangaMap => src/MangaMap}/Resources/Images/account_circle.png (100%) rename {MangaMap => src/MangaMap}/Resources/Images/addepisodes.png (100%) rename {MangaMap => src/MangaMap}/Resources/Images/dotnet_bot.svg (100%) rename {MangaMap => src/MangaMap}/Resources/Images/evangelion.jpg (100%) rename {MangaMap => src/MangaMap}/Resources/Images/listbutton.png (100%) rename {MangaMap => src/MangaMap}/Resources/Images/logo.png (100%) rename {MangaMap => src/MangaMap}/Resources/Images/ok.png (100%) rename {MangaMap => src/MangaMap}/Resources/Images/onepiece.jpg (100%) rename {MangaMap => src/MangaMap}/Resources/Images/oshinoko.png (100%) rename {MangaMap => src/MangaMap}/Resources/Images/settings.png (100%) rename {MangaMap => src/MangaMap}/Resources/Images/star_empty.svg (100%) rename {MangaMap => src/MangaMap}/Resources/Images/star_full.svg (100%) rename {MangaMap => src/MangaMap}/Resources/Raw/AboutAssets.txt (100%) rename {MangaMap => src/MangaMap}/Resources/Splash/splash.svg (100%) rename {MangaMap => src/MangaMap}/Resources/Styles/Colors.xaml (100%) rename {MangaMap => src/MangaMap}/Resources/Styles/Styles.xaml (100%) rename {MangaMap => src/MangaMap}/Resources/Theme/DarkTheme.xaml (100%) rename {MangaMap => src/MangaMap}/Resources/Theme/DarkTheme.xaml.cs (100%) rename {MangaMap => src/MangaMap}/Stub/DataContract.cs (100%) rename {MangaMap => src/MangaMap}/Stub/DataContractJSON.cs (100%) rename {MangaMap => src/MangaMap}/Stub/DataContractXML.cs (100%) rename {MangaMap => src/MangaMap}/Stub/DataToPersist.cs (100%) rename {MangaMap => src/MangaMap}/Stub/Stub.cs (100%) rename {MangaMap => src/MangaMap}/Views/Composants/ListOeuvre.xaml (100%) rename {MangaMap => src/MangaMap}/Views/Composants/ListOeuvre.xaml.cs (100%) rename {MangaMap => src/MangaMap}/Views/Composants/StyleBouton.xaml (100%) rename {MangaMap => src/MangaMap}/Views/Composants/StyleBouton.xaml.cs (100%) rename {MangaMap => src/MangaMap}/Views/CreateOeuvre.xaml.cs (100%) rename {MangaMap => src/MangaMap}/Views/FicheAnime.xaml.cs (100%) rename {MangaMap => src/MangaMap}/Views/createOeuvre.xaml (100%) rename {MangaMap => src/MangaMap}/Views/ficheAnime.xaml (100%) rename {MangaMap => src/MangaMap}/Views/homePage.xaml (100%) rename {MangaMap => src/MangaMap}/Views/homePage.xaml.cs (100%) rename {MangaMap => src/MangaMap}/Views/listPage.xaml (100%) rename {MangaMap => src/MangaMap}/Views/listPage.xaml.cs (100%) rename {MangaMap => src/MangaMap}/Views/loginAdminPage.xaml (100%) rename {MangaMap => src/MangaMap}/Views/loginAdminPage.xaml.cs (100%) rename {MangaMap => src/MangaMap}/Views/loginPage.xaml (100%) rename {MangaMap => src/MangaMap}/Views/loginPage.xaml.cs (100%) rename {MangaMap => src/MangaMap}/Views/settingsPage.xaml (100%) rename {MangaMap => src/MangaMap}/Views/settingsPage.xaml.cs (100%) rename {MangaMap => src/MangaMap}/Views/signUpPage.xaml (100%) rename {MangaMap => src/MangaMap}/Views/signUpPage.xaml.cs (100%) rename {Models => src/Models}/Admin.cs (100%) rename {Models => src/Models}/IPersistanceManager.cs (100%) rename {Models => src/Models}/Liste.cs (100%) rename {Models => src/Models}/Manager.cs (100%) rename {Models => src/Models}/Models.csproj (100%) rename {Models => src/Models}/Oeuvre.cs (100%) rename {Models => src/Models}/Personne.cs (100%) rename {Models => src/Models}/Utilisateur.cs (100%) diff --git a/.drone.yml b/.drone.yml index 99e8c35..931eb7b 100644 --- a/.drone.yml +++ b/.drone.yml @@ -11,7 +11,7 @@ steps: - name: build image: hub.codefirst.iut.uca.fr/marc.chevaldonne/codefirst-dotnet7-maui:latest commands: - - cd MangaMap/ + - cd src/MangaMap/ - dotnet restore MangaMap.sln - dotnet build MangaMap.sln -c Release --no-restore --framework net7.0 - dotnet publish MangaMap.sln -c Release --no-restore -o $CI_PROJECT_DIR/build/release --framework net7.0 @@ -19,7 +19,7 @@ steps: - name: tests image: hub.codefirst.iut.uca.fr/marc.chevaldonne/codefirst-dotnet7-maui:latest commands: - - cd MangaMap/ + - cd src/MangaMap/ - dotnet restore MangaMap.sln - dotnet test MangaMap.sln --logger trx --no-restore /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura --collect "XPlat Code Coverage" depends_on: [build] @@ -34,7 +34,7 @@ steps: sonar_token: from_secret: SECRET_SONAR_LOGIN commands: - - cd MangaMap/ + - cd src/MangaMap/ - dotnet restore MangaMap.sln - dotnet sonarscanner begin /k:"MangaMap" /d:sonar.host.url=$${PLUGIN_SONAR_HOST} /d:sonar.login=$${PLUGIN_SONAR_TOKEN} - dotnet build MangaMap.sln -c Release --no-restore diff --git a/MangaMap/App.xaml b/src/MangaMap/App.xaml similarity index 100% rename from MangaMap/App.xaml rename to src/MangaMap/App.xaml diff --git a/MangaMap/App.xaml.cs b/src/MangaMap/App.xaml.cs similarity index 100% rename from MangaMap/App.xaml.cs rename to src/MangaMap/App.xaml.cs diff --git a/MangaMap/AppShell.xaml b/src/MangaMap/AppShell.xaml similarity index 100% rename from MangaMap/AppShell.xaml rename to src/MangaMap/AppShell.xaml diff --git a/MangaMap/AppShell.xaml.cs b/src/MangaMap/AppShell.xaml.cs similarity index 100% rename from MangaMap/AppShell.xaml.cs rename to src/MangaMap/AppShell.xaml.cs diff --git a/MangaMap/CustomHeader.xaml b/src/MangaMap/CustomHeader.xaml similarity index 100% rename from MangaMap/CustomHeader.xaml rename to src/MangaMap/CustomHeader.xaml diff --git a/MangaMap/CustomHeader.xaml.cs b/src/MangaMap/CustomHeader.xaml.cs similarity index 100% rename from MangaMap/CustomHeader.xaml.cs rename to src/MangaMap/CustomHeader.xaml.cs diff --git a/MangaMap/MainPage.xaml b/src/MangaMap/MainPage.xaml similarity index 100% rename from MangaMap/MainPage.xaml rename to src/MangaMap/MainPage.xaml diff --git a/MangaMap/MainPage.xaml.cs b/src/MangaMap/MainPage.xaml.cs similarity index 100% rename from MangaMap/MainPage.xaml.cs rename to src/MangaMap/MainPage.xaml.cs diff --git a/MangaMap/MangaMap.csproj b/src/MangaMap/MangaMap.csproj similarity index 100% rename from MangaMap/MangaMap.csproj rename to src/MangaMap/MangaMap.csproj diff --git a/MangaMap/MangaMap.sln b/src/MangaMap/MangaMap.sln similarity index 100% rename from MangaMap/MangaMap.sln rename to src/MangaMap/MangaMap.sln diff --git a/MangaMap/MauiProgram.cs b/src/MangaMap/MauiProgram.cs similarity index 100% rename from MangaMap/MauiProgram.cs rename to src/MangaMap/MauiProgram.cs diff --git a/MangaMap/Platforms/Android/AndroidManifest.xml b/src/MangaMap/Platforms/Android/AndroidManifest.xml similarity index 100% rename from MangaMap/Platforms/Android/AndroidManifest.xml rename to src/MangaMap/Platforms/Android/AndroidManifest.xml diff --git a/MangaMap/Platforms/Android/MainActivity.cs b/src/MangaMap/Platforms/Android/MainActivity.cs similarity index 100% rename from MangaMap/Platforms/Android/MainActivity.cs rename to src/MangaMap/Platforms/Android/MainActivity.cs diff --git a/MangaMap/Platforms/Android/MainApplication.cs b/src/MangaMap/Platforms/Android/MainApplication.cs similarity index 100% rename from MangaMap/Platforms/Android/MainApplication.cs rename to src/MangaMap/Platforms/Android/MainApplication.cs diff --git a/MangaMap/Platforms/Android/Resources/values/colors.xml b/src/MangaMap/Platforms/Android/Resources/values/colors.xml similarity index 100% rename from MangaMap/Platforms/Android/Resources/values/colors.xml rename to src/MangaMap/Platforms/Android/Resources/values/colors.xml diff --git a/MangaMap/Platforms/MacCatalyst/AppDelegate.cs b/src/MangaMap/Platforms/MacCatalyst/AppDelegate.cs similarity index 100% rename from MangaMap/Platforms/MacCatalyst/AppDelegate.cs rename to src/MangaMap/Platforms/MacCatalyst/AppDelegate.cs diff --git a/MangaMap/Platforms/MacCatalyst/Info.plist b/src/MangaMap/Platforms/MacCatalyst/Info.plist similarity index 100% rename from MangaMap/Platforms/MacCatalyst/Info.plist rename to src/MangaMap/Platforms/MacCatalyst/Info.plist diff --git a/MangaMap/Platforms/MacCatalyst/Program.cs b/src/MangaMap/Platforms/MacCatalyst/Program.cs similarity index 100% rename from MangaMap/Platforms/MacCatalyst/Program.cs rename to src/MangaMap/Platforms/MacCatalyst/Program.cs diff --git a/MangaMap/Platforms/Tizen/Main.cs b/src/MangaMap/Platforms/Tizen/Main.cs similarity index 100% rename from MangaMap/Platforms/Tizen/Main.cs rename to src/MangaMap/Platforms/Tizen/Main.cs diff --git a/MangaMap/Platforms/Tizen/tizen-manifest.xml b/src/MangaMap/Platforms/Tizen/tizen-manifest.xml similarity index 100% rename from MangaMap/Platforms/Tizen/tizen-manifest.xml rename to src/MangaMap/Platforms/Tizen/tizen-manifest.xml diff --git a/MangaMap/Platforms/Windows/App.xaml b/src/MangaMap/Platforms/Windows/App.xaml similarity index 100% rename from MangaMap/Platforms/Windows/App.xaml rename to src/MangaMap/Platforms/Windows/App.xaml diff --git a/MangaMap/Platforms/Windows/App.xaml.cs b/src/MangaMap/Platforms/Windows/App.xaml.cs similarity index 100% rename from MangaMap/Platforms/Windows/App.xaml.cs rename to src/MangaMap/Platforms/Windows/App.xaml.cs diff --git a/MangaMap/Platforms/Windows/Package.appxmanifest b/src/MangaMap/Platforms/Windows/Package.appxmanifest similarity index 100% rename from MangaMap/Platforms/Windows/Package.appxmanifest rename to src/MangaMap/Platforms/Windows/Package.appxmanifest diff --git a/MangaMap/Platforms/Windows/app.manifest b/src/MangaMap/Platforms/Windows/app.manifest similarity index 100% rename from MangaMap/Platforms/Windows/app.manifest rename to src/MangaMap/Platforms/Windows/app.manifest diff --git a/MangaMap/Platforms/iOS/AppDelegate.cs b/src/MangaMap/Platforms/iOS/AppDelegate.cs similarity index 100% rename from MangaMap/Platforms/iOS/AppDelegate.cs rename to src/MangaMap/Platforms/iOS/AppDelegate.cs diff --git a/MangaMap/Platforms/iOS/Info.plist b/src/MangaMap/Platforms/iOS/Info.plist similarity index 100% rename from MangaMap/Platforms/iOS/Info.plist rename to src/MangaMap/Platforms/iOS/Info.plist diff --git a/MangaMap/Platforms/iOS/Program.cs b/src/MangaMap/Platforms/iOS/Program.cs similarity index 100% rename from MangaMap/Platforms/iOS/Program.cs rename to src/MangaMap/Platforms/iOS/Program.cs diff --git a/MangaMap/Properties/launchSettings.json b/src/MangaMap/Properties/launchSettings.json similarity index 100% rename from MangaMap/Properties/launchSettings.json rename to src/MangaMap/Properties/launchSettings.json diff --git a/MangaMap/Resources/AppIcon/appicon.svg b/src/MangaMap/Resources/AppIcon/appicon.svg similarity index 100% rename from MangaMap/Resources/AppIcon/appicon.svg rename to src/MangaMap/Resources/AppIcon/appicon.svg diff --git a/MangaMap/Resources/AppIcon/appiconfg.svg b/src/MangaMap/Resources/AppIcon/appiconfg.svg similarity index 100% rename from MangaMap/Resources/AppIcon/appiconfg.svg rename to src/MangaMap/Resources/AppIcon/appiconfg.svg diff --git a/MangaMap/Resources/AppIcon/logo.png b/src/MangaMap/Resources/AppIcon/logo.png similarity index 100% rename from MangaMap/Resources/AppIcon/logo.png rename to src/MangaMap/Resources/AppIcon/logo.png diff --git a/MangaMap/Resources/Fonts/OpenSans-Regular.ttf b/src/MangaMap/Resources/Fonts/OpenSans-Regular.ttf similarity index 100% rename from MangaMap/Resources/Fonts/OpenSans-Regular.ttf rename to src/MangaMap/Resources/Fonts/OpenSans-Regular.ttf diff --git a/MangaMap/Resources/Fonts/OpenSans-Semibold.ttf b/src/MangaMap/Resources/Fonts/OpenSans-Semibold.ttf similarity index 100% rename from MangaMap/Resources/Fonts/OpenSans-Semibold.ttf rename to src/MangaMap/Resources/Fonts/OpenSans-Semibold.ttf diff --git a/MangaMap/Resources/Images/account_circle.png b/src/MangaMap/Resources/Images/account_circle.png similarity index 100% rename from MangaMap/Resources/Images/account_circle.png rename to src/MangaMap/Resources/Images/account_circle.png diff --git a/MangaMap/Resources/Images/addepisodes.png b/src/MangaMap/Resources/Images/addepisodes.png similarity index 100% rename from MangaMap/Resources/Images/addepisodes.png rename to src/MangaMap/Resources/Images/addepisodes.png diff --git a/MangaMap/Resources/Images/dotnet_bot.svg b/src/MangaMap/Resources/Images/dotnet_bot.svg similarity index 100% rename from MangaMap/Resources/Images/dotnet_bot.svg rename to src/MangaMap/Resources/Images/dotnet_bot.svg diff --git a/MangaMap/Resources/Images/evangelion.jpg b/src/MangaMap/Resources/Images/evangelion.jpg similarity index 100% rename from MangaMap/Resources/Images/evangelion.jpg rename to src/MangaMap/Resources/Images/evangelion.jpg diff --git a/MangaMap/Resources/Images/listbutton.png b/src/MangaMap/Resources/Images/listbutton.png similarity index 100% rename from MangaMap/Resources/Images/listbutton.png rename to src/MangaMap/Resources/Images/listbutton.png diff --git a/MangaMap/Resources/Images/logo.png b/src/MangaMap/Resources/Images/logo.png similarity index 100% rename from MangaMap/Resources/Images/logo.png rename to src/MangaMap/Resources/Images/logo.png diff --git a/MangaMap/Resources/Images/ok.png b/src/MangaMap/Resources/Images/ok.png similarity index 100% rename from MangaMap/Resources/Images/ok.png rename to src/MangaMap/Resources/Images/ok.png diff --git a/MangaMap/Resources/Images/onepiece.jpg b/src/MangaMap/Resources/Images/onepiece.jpg similarity index 100% rename from MangaMap/Resources/Images/onepiece.jpg rename to src/MangaMap/Resources/Images/onepiece.jpg diff --git a/MangaMap/Resources/Images/oshinoko.png b/src/MangaMap/Resources/Images/oshinoko.png similarity index 100% rename from MangaMap/Resources/Images/oshinoko.png rename to src/MangaMap/Resources/Images/oshinoko.png diff --git a/MangaMap/Resources/Images/settings.png b/src/MangaMap/Resources/Images/settings.png similarity index 100% rename from MangaMap/Resources/Images/settings.png rename to src/MangaMap/Resources/Images/settings.png diff --git a/MangaMap/Resources/Images/star_empty.svg b/src/MangaMap/Resources/Images/star_empty.svg similarity index 100% rename from MangaMap/Resources/Images/star_empty.svg rename to src/MangaMap/Resources/Images/star_empty.svg diff --git a/MangaMap/Resources/Images/star_full.svg b/src/MangaMap/Resources/Images/star_full.svg similarity index 100% rename from MangaMap/Resources/Images/star_full.svg rename to src/MangaMap/Resources/Images/star_full.svg diff --git a/MangaMap/Resources/Raw/AboutAssets.txt b/src/MangaMap/Resources/Raw/AboutAssets.txt similarity index 100% rename from MangaMap/Resources/Raw/AboutAssets.txt rename to src/MangaMap/Resources/Raw/AboutAssets.txt diff --git a/MangaMap/Resources/Splash/splash.svg b/src/MangaMap/Resources/Splash/splash.svg similarity index 100% rename from MangaMap/Resources/Splash/splash.svg rename to src/MangaMap/Resources/Splash/splash.svg diff --git a/MangaMap/Resources/Styles/Colors.xaml b/src/MangaMap/Resources/Styles/Colors.xaml similarity index 100% rename from MangaMap/Resources/Styles/Colors.xaml rename to src/MangaMap/Resources/Styles/Colors.xaml diff --git a/MangaMap/Resources/Styles/Styles.xaml b/src/MangaMap/Resources/Styles/Styles.xaml similarity index 100% rename from MangaMap/Resources/Styles/Styles.xaml rename to src/MangaMap/Resources/Styles/Styles.xaml diff --git a/MangaMap/Resources/Theme/DarkTheme.xaml b/src/MangaMap/Resources/Theme/DarkTheme.xaml similarity index 100% rename from MangaMap/Resources/Theme/DarkTheme.xaml rename to src/MangaMap/Resources/Theme/DarkTheme.xaml diff --git a/MangaMap/Resources/Theme/DarkTheme.xaml.cs b/src/MangaMap/Resources/Theme/DarkTheme.xaml.cs similarity index 100% rename from MangaMap/Resources/Theme/DarkTheme.xaml.cs rename to src/MangaMap/Resources/Theme/DarkTheme.xaml.cs diff --git a/MangaMap/Stub/DataContract.cs b/src/MangaMap/Stub/DataContract.cs similarity index 100% rename from MangaMap/Stub/DataContract.cs rename to src/MangaMap/Stub/DataContract.cs diff --git a/MangaMap/Stub/DataContractJSON.cs b/src/MangaMap/Stub/DataContractJSON.cs similarity index 100% rename from MangaMap/Stub/DataContractJSON.cs rename to src/MangaMap/Stub/DataContractJSON.cs diff --git a/MangaMap/Stub/DataContractXML.cs b/src/MangaMap/Stub/DataContractXML.cs similarity index 100% rename from MangaMap/Stub/DataContractXML.cs rename to src/MangaMap/Stub/DataContractXML.cs diff --git a/MangaMap/Stub/DataToPersist.cs b/src/MangaMap/Stub/DataToPersist.cs similarity index 100% rename from MangaMap/Stub/DataToPersist.cs rename to src/MangaMap/Stub/DataToPersist.cs diff --git a/MangaMap/Stub/Stub.cs b/src/MangaMap/Stub/Stub.cs similarity index 100% rename from MangaMap/Stub/Stub.cs rename to src/MangaMap/Stub/Stub.cs diff --git a/MangaMap/Views/Composants/ListOeuvre.xaml b/src/MangaMap/Views/Composants/ListOeuvre.xaml similarity index 100% rename from MangaMap/Views/Composants/ListOeuvre.xaml rename to src/MangaMap/Views/Composants/ListOeuvre.xaml diff --git a/MangaMap/Views/Composants/ListOeuvre.xaml.cs b/src/MangaMap/Views/Composants/ListOeuvre.xaml.cs similarity index 100% rename from MangaMap/Views/Composants/ListOeuvre.xaml.cs rename to src/MangaMap/Views/Composants/ListOeuvre.xaml.cs diff --git a/MangaMap/Views/Composants/StyleBouton.xaml b/src/MangaMap/Views/Composants/StyleBouton.xaml similarity index 100% rename from MangaMap/Views/Composants/StyleBouton.xaml rename to src/MangaMap/Views/Composants/StyleBouton.xaml diff --git a/MangaMap/Views/Composants/StyleBouton.xaml.cs b/src/MangaMap/Views/Composants/StyleBouton.xaml.cs similarity index 100% rename from MangaMap/Views/Composants/StyleBouton.xaml.cs rename to src/MangaMap/Views/Composants/StyleBouton.xaml.cs diff --git a/MangaMap/Views/CreateOeuvre.xaml.cs b/src/MangaMap/Views/CreateOeuvre.xaml.cs similarity index 100% rename from MangaMap/Views/CreateOeuvre.xaml.cs rename to src/MangaMap/Views/CreateOeuvre.xaml.cs diff --git a/MangaMap/Views/FicheAnime.xaml.cs b/src/MangaMap/Views/FicheAnime.xaml.cs similarity index 100% rename from MangaMap/Views/FicheAnime.xaml.cs rename to src/MangaMap/Views/FicheAnime.xaml.cs diff --git a/MangaMap/Views/createOeuvre.xaml b/src/MangaMap/Views/createOeuvre.xaml similarity index 100% rename from MangaMap/Views/createOeuvre.xaml rename to src/MangaMap/Views/createOeuvre.xaml diff --git a/MangaMap/Views/ficheAnime.xaml b/src/MangaMap/Views/ficheAnime.xaml similarity index 100% rename from MangaMap/Views/ficheAnime.xaml rename to src/MangaMap/Views/ficheAnime.xaml diff --git a/MangaMap/Views/homePage.xaml b/src/MangaMap/Views/homePage.xaml similarity index 100% rename from MangaMap/Views/homePage.xaml rename to src/MangaMap/Views/homePage.xaml diff --git a/MangaMap/Views/homePage.xaml.cs b/src/MangaMap/Views/homePage.xaml.cs similarity index 100% rename from MangaMap/Views/homePage.xaml.cs rename to src/MangaMap/Views/homePage.xaml.cs diff --git a/MangaMap/Views/listPage.xaml b/src/MangaMap/Views/listPage.xaml similarity index 100% rename from MangaMap/Views/listPage.xaml rename to src/MangaMap/Views/listPage.xaml diff --git a/MangaMap/Views/listPage.xaml.cs b/src/MangaMap/Views/listPage.xaml.cs similarity index 100% rename from MangaMap/Views/listPage.xaml.cs rename to src/MangaMap/Views/listPage.xaml.cs diff --git a/MangaMap/Views/loginAdminPage.xaml b/src/MangaMap/Views/loginAdminPage.xaml similarity index 100% rename from MangaMap/Views/loginAdminPage.xaml rename to src/MangaMap/Views/loginAdminPage.xaml diff --git a/MangaMap/Views/loginAdminPage.xaml.cs b/src/MangaMap/Views/loginAdminPage.xaml.cs similarity index 100% rename from MangaMap/Views/loginAdminPage.xaml.cs rename to src/MangaMap/Views/loginAdminPage.xaml.cs diff --git a/MangaMap/Views/loginPage.xaml b/src/MangaMap/Views/loginPage.xaml similarity index 100% rename from MangaMap/Views/loginPage.xaml rename to src/MangaMap/Views/loginPage.xaml diff --git a/MangaMap/Views/loginPage.xaml.cs b/src/MangaMap/Views/loginPage.xaml.cs similarity index 100% rename from MangaMap/Views/loginPage.xaml.cs rename to src/MangaMap/Views/loginPage.xaml.cs diff --git a/MangaMap/Views/settingsPage.xaml b/src/MangaMap/Views/settingsPage.xaml similarity index 100% rename from MangaMap/Views/settingsPage.xaml rename to src/MangaMap/Views/settingsPage.xaml diff --git a/MangaMap/Views/settingsPage.xaml.cs b/src/MangaMap/Views/settingsPage.xaml.cs similarity index 100% rename from MangaMap/Views/settingsPage.xaml.cs rename to src/MangaMap/Views/settingsPage.xaml.cs diff --git a/MangaMap/Views/signUpPage.xaml b/src/MangaMap/Views/signUpPage.xaml similarity index 100% rename from MangaMap/Views/signUpPage.xaml rename to src/MangaMap/Views/signUpPage.xaml diff --git a/MangaMap/Views/signUpPage.xaml.cs b/src/MangaMap/Views/signUpPage.xaml.cs similarity index 100% rename from MangaMap/Views/signUpPage.xaml.cs rename to src/MangaMap/Views/signUpPage.xaml.cs diff --git a/Models/Admin.cs b/src/Models/Admin.cs similarity index 100% rename from Models/Admin.cs rename to src/Models/Admin.cs diff --git a/Models/IPersistanceManager.cs b/src/Models/IPersistanceManager.cs similarity index 100% rename from Models/IPersistanceManager.cs rename to src/Models/IPersistanceManager.cs diff --git a/Models/Liste.cs b/src/Models/Liste.cs similarity index 100% rename from Models/Liste.cs rename to src/Models/Liste.cs diff --git a/Models/Manager.cs b/src/Models/Manager.cs similarity index 100% rename from Models/Manager.cs rename to src/Models/Manager.cs diff --git a/Models/Models.csproj b/src/Models/Models.csproj similarity index 100% rename from Models/Models.csproj rename to src/Models/Models.csproj diff --git a/Models/Oeuvre.cs b/src/Models/Oeuvre.cs similarity index 100% rename from Models/Oeuvre.cs rename to src/Models/Oeuvre.cs diff --git a/Models/Personne.cs b/src/Models/Personne.cs similarity index 100% rename from Models/Personne.cs rename to src/Models/Personne.cs diff --git a/Models/Utilisateur.cs b/src/Models/Utilisateur.cs similarity index 100% rename from Models/Utilisateur.cs rename to src/Models/Utilisateur.cs From 131369207de342333c658f19bc9075c07a0a2705 Mon Sep 17 00:00:00 2001 From: Matheo HERSAN Date: Thu, 8 Jun 2023 14:26:18 +0200 Subject: [PATCH 04/15] Test drone --- src/MangaMap/MangaMap.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/MangaMap/MangaMap.csproj b/src/MangaMap/MangaMap.csproj index d11847b..bb8a331 100644 --- a/src/MangaMap/MangaMap.csproj +++ b/src/MangaMap/MangaMap.csproj @@ -1,11 +1,11 @@  - net7.0-android;net7.0-ios;net7.0-maccatalyst + net7.0; $(TargetFrameworks);net7.0-windows10.0.19041.0 - Exe + Exe MangaMap true true From f37a8c7c7024d96ef360b654b6ab21644891a3f5 Mon Sep 17 00:00:00 2001 From: Matheo HERSAN Date: Thu, 8 Jun 2023 14:31:10 +0200 Subject: [PATCH 05/15] Update 'Documentation/doxygen/Doxyfile' --- Documentation/doxygen/Doxyfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/doxygen/Doxyfile b/Documentation/doxygen/Doxyfile index 40db241..315c6a6 100644 --- a/Documentation/doxygen/Doxyfile +++ b/Documentation/doxygen/Doxyfile @@ -125,7 +125,7 @@ WARN_LOGFILE = # Configuration options related to the input files #--------------------------------------------------------------------------- -INPUT = MangaMap +INPUT = src/MangaMap INPUT_ENCODING = UTF-8 FILE_PATTERNS = *.c \ *.cc \ From 14e64eeb759df2e645b31f9f543c58f010aea9c3 Mon Sep 17 00:00:00 2001 From: Matheo HERSAN Date: Thu, 8 Jun 2023 14:34:50 +0200 Subject: [PATCH 06/15] Update 'Documentation/doxygen/Doxyfile' --- Documentation/doxygen/Doxyfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/doxygen/Doxyfile b/Documentation/doxygen/Doxyfile index 315c6a6..02fd53f 100644 --- a/Documentation/doxygen/Doxyfile +++ b/Documentation/doxygen/Doxyfile @@ -125,7 +125,7 @@ WARN_LOGFILE = # Configuration options related to the input files #--------------------------------------------------------------------------- -INPUT = src/MangaMap +INPUT = src INPUT_ENCODING = UTF-8 FILE_PATTERNS = *.c \ *.cc \ From ce3a45a448e3b66c48971fcd8de004316d3b9e0f Mon Sep 17 00:00:00 2001 From: Matheo HERSAN Date: Thu, 8 Jun 2023 15:00:14 +0200 Subject: [PATCH 07/15] Start UnitTest --- src/MangaMap/App.xaml.cs | 4 +- .../DataContract.cs | 2 +- .../DataContractJSON.cs | 4 +- .../DataContractXML.cs | 2 +- .../DataToPersist.cs | 2 +- src/MangaMap/MangaMap.sln | 8 ++- src/UnitTests/UnitTestUtilisateur.cs | 57 +++++++++++++++++++ src/UnitTests/UnitTests.csproj | 28 +++++++++ src/UnitTests/Usings.cs | 1 + 9 files changed, 100 insertions(+), 8 deletions(-) rename src/MangaMap/{Stub => DataContractPersistance}/DataContract.cs (95%) rename src/MangaMap/{Stub => DataContractPersistance}/DataContractJSON.cs (97%) rename src/MangaMap/{Stub => DataContractPersistance}/DataContractXML.cs (98%) rename src/MangaMap/{Stub => DataContractPersistance}/DataToPersist.cs (91%) create mode 100644 src/UnitTests/UnitTestUtilisateur.cs create mode 100644 src/UnitTests/UnitTests.csproj create mode 100644 src/UnitTests/Usings.cs diff --git a/src/MangaMap/App.xaml.cs b/src/MangaMap/App.xaml.cs index e7f4845..734d883 100644 --- a/src/MangaMap/App.xaml.cs +++ b/src/MangaMap/App.xaml.cs @@ -39,7 +39,7 @@ public partial class App : Application if (File.Exists(Path.Combine(FilePath, FileName))) { - MyManager = new Manager(new Stub.DataContractXML()); // Utilise le DataContract comme moyen de persistance. + MyManager = new Manager(new DataContractPersistance.DataContractXML()); // Utilise le DataContract comme moyen de persistance. //MyManager = new Manager(new Stub.DataContractJSON()); // Utilise le DataContract comme moyen de persistance. } @@ -50,7 +50,7 @@ public partial class App : Application if (!File.Exists(Path.Combine(FilePath, FileName))) { - MyManager.Persistance = new Stub.DataContractXML(); // Utilise le Stub comme moyen de persistance. + MyManager.Persistance = new DataContractPersistance.DataContractXML(); // Utilise le Stub comme moyen de persistance. //MyManager = new Manager(new Stub.DataContractJSON()); } diff --git a/src/MangaMap/Stub/DataContract.cs b/src/MangaMap/DataContractPersistance/DataContract.cs similarity index 95% rename from src/MangaMap/Stub/DataContract.cs rename to src/MangaMap/DataContractPersistance/DataContract.cs index 2c5f255..52b7b2f 100644 --- a/src/MangaMap/Stub/DataContract.cs +++ b/src/MangaMap/DataContractPersistance/DataContract.cs @@ -9,7 +9,7 @@ using System.Text; using System.Threading.Tasks; using System.Xml; -namespace MangaMap.Stub +namespace MangaMap.DataContractPersistance { /// /// Implémentation de l'interface IPersistanceManager utilisant la sérialisation avec DataContract. diff --git a/src/MangaMap/Stub/DataContractJSON.cs b/src/MangaMap/DataContractPersistance/DataContractJSON.cs similarity index 97% rename from src/MangaMap/Stub/DataContractJSON.cs rename to src/MangaMap/DataContractPersistance/DataContractJSON.cs index 617f310..08fb73a 100644 --- a/src/MangaMap/Stub/DataContractJSON.cs +++ b/src/MangaMap/DataContractPersistance/DataContractJSON.cs @@ -8,7 +8,7 @@ using System.Runtime.Serialization.Json; using System.Text; using System.Threading.Tasks; -namespace MangaMap.Stub +namespace MangaMap.DataContractPersistance { /// /// Implémentation de l'interface IPersistanceManager utilisant la sérialisation avec DataContract. @@ -65,7 +65,7 @@ namespace MangaMap.Stub { using (var writer = JsonReaderWriterFactory.CreateJsonWriter( stream, - System.Text.Encoding.UTF8, + Encoding.UTF8, false, true))//<- this boolean says that we sant indentation { diff --git a/src/MangaMap/Stub/DataContractXML.cs b/src/MangaMap/DataContractPersistance/DataContractXML.cs similarity index 98% rename from src/MangaMap/Stub/DataContractXML.cs rename to src/MangaMap/DataContractPersistance/DataContractXML.cs index 2def370..5c09abf 100644 --- a/src/MangaMap/Stub/DataContractXML.cs +++ b/src/MangaMap/DataContractPersistance/DataContractXML.cs @@ -9,7 +9,7 @@ using System.Text; using System.Threading.Tasks; using System.Xml; -namespace MangaMap.Stub +namespace MangaMap.DataContractPersistance { /// /// Implémentation de l'interface IPersistanceManager utilisant la sérialisation avec DataContract. diff --git a/src/MangaMap/Stub/DataToPersist.cs b/src/MangaMap/DataContractPersistance/DataToPersist.cs similarity index 91% rename from src/MangaMap/Stub/DataToPersist.cs rename to src/MangaMap/DataContractPersistance/DataToPersist.cs index 6f79fb1..01cb813 100644 --- a/src/MangaMap/Stub/DataToPersist.cs +++ b/src/MangaMap/DataContractPersistance/DataToPersist.cs @@ -6,7 +6,7 @@ using System.Text; using System.Threading.Tasks; using System.Collections.ObjectModel; -namespace MangaMap.Stub +namespace MangaMap.DataContractPersistance { /// /// Classe de données pour la persistance contenant les listes des oeuvres et des utilisateurs. diff --git a/src/MangaMap/MangaMap.sln b/src/MangaMap/MangaMap.sln index 499c747..954526f 100644 --- a/src/MangaMap/MangaMap.sln +++ b/src/MangaMap/MangaMap.sln @@ -5,7 +5,9 @@ VisualStudioVersion = 17.0.31611.283 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MangaMap", "MangaMap.csproj", "{1946288E-37BA-420F-89BD-A1C3D4178344}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Models", "..\Models\Models.csproj", "{D13B26C4-A575-4577-A735-0B04DC02BC85}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Models", "..\Models\Models.csproj", "{D13B26C4-A575-4577-A735-0B04DC02BC85}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests", "..\UnitTests\UnitTests.csproj", "{6B675815-FEE2-49D0-BAF9-84ECD5116FF9}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -23,6 +25,10 @@ Global {D13B26C4-A575-4577-A735-0B04DC02BC85}.Debug|Any CPU.Build.0 = Debug|Any CPU {D13B26C4-A575-4577-A735-0B04DC02BC85}.Release|Any CPU.ActiveCfg = Release|Any CPU {D13B26C4-A575-4577-A735-0B04DC02BC85}.Release|Any CPU.Build.0 = Release|Any CPU + {6B675815-FEE2-49D0-BAF9-84ECD5116FF9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6B675815-FEE2-49D0-BAF9-84ECD5116FF9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6B675815-FEE2-49D0-BAF9-84ECD5116FF9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6B675815-FEE2-49D0-BAF9-84ECD5116FF9}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/UnitTests/UnitTestUtilisateur.cs b/src/UnitTests/UnitTestUtilisateur.cs new file mode 100644 index 0000000..7f903a3 --- /dev/null +++ b/src/UnitTests/UnitTestUtilisateur.cs @@ -0,0 +1,57 @@ +using Models; + +namespace UnitTests +{ + public class UnitTestUtilisateur + { + [Fact] + public void TestUtilisateur() + { + // Arrange + Utilisateur utilisateur = new Utilisateur("test@test.com", "pseudo", "mdp", "John", "Doe", 30); + + // Act + utilisateur.SupprimerUtilisateur(); + + // Assert + Assert.Null(utilisateur.nom); + Assert.Null(utilisateur.prenom); + Assert.Equal(0, utilisateur.age); + } + + [Fact] + public void Utilisateur_DefaultConstructor_SetsPropertiesToDefaultValues() + { + // Arrange & Act + Utilisateur utilisateur = new Utilisateur(); + + // Assert + Assert.Null(utilisateur.nom); + Assert.Null(utilisateur.prenom); + Assert.Equal(0, utilisateur.age); + } + + [Fact] + public void Utilisateur_Constructor_SetsPropertiesCorrectly() + { + // Arrange + string email = "test@test.com"; + string pseudo = "pseudo"; + string mdp = "mdp"; + string nom = "John"; + string prenom = "Doe"; + int age = 30; + + // Act + Utilisateur utilisateur = new Utilisateur(email, pseudo, mdp, nom, prenom, age); + + // Assert + Assert.Equal(email, utilisateur.Email); + Assert.Equal(pseudo, utilisateur.Pseudo); + Assert.Equal(mdp, utilisateur.MotDePasse); + Assert.Equal(nom, utilisateur.nom); + Assert.Equal(prenom, utilisateur.prenom); + Assert.Equal(age, utilisateur.age); + } + } +} \ No newline at end of file diff --git a/src/UnitTests/UnitTests.csproj b/src/UnitTests/UnitTests.csproj new file mode 100644 index 0000000..de864cf --- /dev/null +++ b/src/UnitTests/UnitTests.csproj @@ -0,0 +1,28 @@ + + + + net7.0 + enable + enable + + false + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + + + + diff --git a/src/UnitTests/Usings.cs b/src/UnitTests/Usings.cs new file mode 100644 index 0000000..8c927eb --- /dev/null +++ b/src/UnitTests/Usings.cs @@ -0,0 +1 @@ +global using Xunit; \ No newline at end of file From 5fc4f04da492cc375bc20fdaf3d6b221c8bad276 Mon Sep 17 00:00:00 2001 From: Matheo HERSAN Date: Thu, 8 Jun 2023 15:06:36 +0200 Subject: [PATCH 08/15] Update '.drone.yml' --- .drone.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.drone.yml b/.drone.yml index 931eb7b..c9ec7da 100644 --- a/.drone.yml +++ b/.drone.yml @@ -19,9 +19,10 @@ steps: - name: tests image: hub.codefirst.iut.uca.fr/marc.chevaldonne/codefirst-dotnet7-maui:latest commands: - - cd src/MangaMap/ - - dotnet restore MangaMap.sln - - dotnet test MangaMap.sln --logger trx --no-restore /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura --collect "XPlat Code Coverage" +# - cd src/MangaMap/ +# - dotnet restore MangaMap.sln +# - dotnet test MangaMap.sln --logger trx --no-restore /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura --collect "XPlat Code Coverage" + - dotnet test --framework net7.0 'src/UnitTests/UnitTests.csproj' depends_on: [build] - name: code-analysis From 7bbc62a4852db15e1e9a724f989023eb0f8dee32 Mon Sep 17 00:00:00 2001 From: Matheo HERSAN Date: Thu, 8 Jun 2023 15:09:03 +0200 Subject: [PATCH 09/15] Update '.drone.yml' --- .drone.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.drone.yml b/.drone.yml index c9ec7da..1e24ec2 100644 --- a/.drone.yml +++ b/.drone.yml @@ -19,10 +19,9 @@ steps: - name: tests image: hub.codefirst.iut.uca.fr/marc.chevaldonne/codefirst-dotnet7-maui:latest commands: -# - cd src/MangaMap/ -# - dotnet restore MangaMap.sln -# - dotnet test MangaMap.sln --logger trx --no-restore /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura --collect "XPlat Code Coverage" - - dotnet test --framework net7.0 'src/UnitTests/UnitTests.csproj' + - cd src/MangaMap/ + - dotnet restore MangaMap.sln + - dotnet test MangaMap.sln --logger trx --no-restore /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura --collect "XPlat Code Coverage" depends_on: [build] - name: code-analysis From 85087dbfb8c5e6d97c8a6939e5e0665de7c3b3b9 Mon Sep 17 00:00:00 2001 From: Matheo HERSAN Date: Thu, 8 Jun 2023 15:09:47 +0200 Subject: [PATCH 10/15] Update '.drone.yml' --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 1e24ec2..5c0a580 100644 --- a/.drone.yml +++ b/.drone.yml @@ -20,7 +20,7 @@ steps: image: hub.codefirst.iut.uca.fr/marc.chevaldonne/codefirst-dotnet7-maui:latest commands: - cd src/MangaMap/ - - dotnet restore MangaMap.sln + - dotnet restore MangaMap.sln - dotnet test MangaMap.sln --logger trx --no-restore /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura --collect "XPlat Code Coverage" depends_on: [build] From 707b01344d9848347e775cf4afd68ab985791ca1 Mon Sep 17 00:00:00 2001 From: Matheo HERSAN Date: Thu, 8 Jun 2023 17:11:13 +0200 Subject: [PATCH 11/15] Update 'README.md' --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 885fdf1..a977fe1 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,13 @@ Vianney Jourdy (G9) Hersan Mathéo (G10) + +[![Build Status](https://codefirst.iut.uca.fr/api/badges/antoine.perederii/Banquale/status.svg)](https://codefirst.iut.uca.fr/vianney.jourdy/MapManga) +[![Quality Gate Status](https://codefirst.iut.uca.fr/sonar/api/project_badges/measure?project=Banquale&metric=alert_status&token=1a49717e4d2f15e2eecaaa971ebd8c83fb9bd5c5)](https://codefirst.iut.uca.fr/sonar/dashboard?id=MangaMap) +[![Bugs](https://codefirst.iut.uca.fr/sonar/api/project_badges/measure?project=Banquale&metric=bugs&token=1a49717e4d2f15e2eecaaa971ebd8c83fb9bd5c5)](https://codefirst.iut.uca.fr/sonar/dashboard?id=MangaMap) +[![Coverage](https://codefirst.iut.uca.fr/sonar/api/project_badges/measure?project=Banquale&metric=coverage&token=1a49717e4d2f15e2eecaaa971ebd8c83fb9bd5c5)](https://codefirst.iut.uca.fr/sonar/dashboard?id=MangaMap) +[![Vulnerabilities](https://codefirst.iut.uca.fr/sonar/api/project_badges/measure?project=Banquale&metric=vulnerabilities&token=1a49717e4d2f15e2eecaaa971ebd8c83fb9bd5c5)](https://codefirst.iut.uca.fr/sonar/dashboard?id=MangaMap) + ## Overview MapManga is an application designed to help manga and anime fans manage their reading and viewing experience. If you are a manga and anime fan, MapManga is the perfect application for you. From 55c7c87ebbf73b980313205bb20cbe677119b6df Mon Sep 17 00:00:00 2001 From: HMatheo Date: Thu, 8 Jun 2023 19:48:03 +0200 Subject: [PATCH 12/15] UnitTest for Oeuvre.cs works --- .../DataContractPersistance/DataContract.cs | 82 ------------------- src/MangaMap/MangaMap.csproj | 4 +- src/Models/Oeuvre.cs | 1 + src/UnitTests/UnitTestOeuvre.cs | 76 +++++++++++++++++ 4 files changed, 79 insertions(+), 84 deletions(-) delete mode 100644 src/MangaMap/DataContractPersistance/DataContract.cs create mode 100644 src/UnitTests/UnitTestOeuvre.cs diff --git a/src/MangaMap/DataContractPersistance/DataContract.cs b/src/MangaMap/DataContractPersistance/DataContract.cs deleted file mode 100644 index 52b7b2f..0000000 --- a/src/MangaMap/DataContractPersistance/DataContract.cs +++ /dev/null @@ -1,82 +0,0 @@ -using Models; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Linq; -using System.Runtime.Serialization; -using System.Text; -using System.Threading.Tasks; -using System.Xml; - -namespace MangaMap.DataContractPersistance -{ - /// - /// Implémentation de l'interface IPersistanceManager utilisant la sérialisation avec DataContract. - /// - public class DataContract : IPersistanceManager - { - /// - /// Obtient ou définit le nom du fichier de sauvegarde. - /// - public string FileName { get; set; } = "SauvegardeDonnees.xml"; - - /// - /// Obtient ou définit le chemin du fichier de sauvegarde. - /// - public string FilePath { get; set; } = Path.Combine(AppDomain.CurrentDomain.BaseDirectory); - - /// - /// Charge les données sauvegardées à partir du fichier xml. - /// - /// Un tuple contenant la liste des oeuvres et la liste des utilisateurs. - public (ObservableCollection, List) chargeDonne() - { - var serializer = new DataContractSerializer(typeof(DataToPersist)); - DataToPersist data; - - if (File.Exists(Path.Combine(FilePath, FileName))) // Vérifiez si le fichier existe - { - using (Stream s = File.OpenRead(Path.Combine(FilePath, FileName))) - { - data = serializer.ReadObject(s) as DataToPersist; - } - } - else - { - data = new DataToPersist(); // Si le fichier n'existe pas, créez une nouvelle liste - } - - return (data.Oeuvres, data.Utilisateurs); - } - - /// - /// Sauvegarde les données dans le fichier xml. - /// - /// La liste des oeuvres à sauvegarder. - /// La liste des utilisateurs à sauvegarder. - public void sauvegarder(ObservableCollection o, List u) - { - var serializer = new DataContractSerializer(typeof(DataToPersist)); - - if (!Directory.Exists(FilePath)) - { - Debug.WriteLine("Directory doesn't exist."); - Directory.CreateDirectory(FilePath); - } - - DataToPersist data = new DataToPersist(); - data.Oeuvres = o; - data.Utilisateurs = u; - - var settings = new XmlWriterSettings() { Indent = true }; - using (TextWriter tw = File.CreateText(Path.Combine(FilePath, FileName))) - { - using (XmlWriter w = XmlWriter.Create(tw, settings)) - { - serializer.WriteObject(w, data); // Version d'enregistrement des données avec indentation. - } - } - } - } -} diff --git a/src/MangaMap/MangaMap.csproj b/src/MangaMap/MangaMap.csproj index bb8a331..d11847b 100644 --- a/src/MangaMap/MangaMap.csproj +++ b/src/MangaMap/MangaMap.csproj @@ -1,11 +1,11 @@  - net7.0; + net7.0-android;net7.0-ios;net7.0-maccatalyst $(TargetFrameworks);net7.0-windows10.0.19041.0 - Exe + Exe MangaMap true true diff --git a/src/Models/Oeuvre.cs b/src/Models/Oeuvre.cs index 6e33fc8..f8295e9 100644 --- a/src/Models/Oeuvre.cs +++ b/src/Models/Oeuvre.cs @@ -106,6 +106,7 @@ namespace Models public Oeuvre(string nom, string type, string description, int nbEpisode, string affiche) { Nom = nom; + Genre = new List(); Type = type; Description = description; NbEpisodes = nbEpisode; diff --git a/src/UnitTests/UnitTestOeuvre.cs b/src/UnitTests/UnitTestOeuvre.cs new file mode 100644 index 0000000..5449031 --- /dev/null +++ b/src/UnitTests/UnitTestOeuvre.cs @@ -0,0 +1,76 @@ +using Models; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace UnitTests +{ + public class UnitTestOeuvre + { + [Fact] + public void Oeuvre_Constructor_WithAllParameters_ShouldSetPropertiesCorrectly() + { + // Arrange + string nom = "[Oshi No Ko]"; + List genre = new List { "Action", "Drama", "Fantasy" }; + string type = "TV Series"; + string description = "A thrilling anime series."; + int note = 9; + int nbEpisodes = 25; + string affiche = "oshinoko.png"; + + // Act + Oeuvre oeuvre = new Oeuvre(nom, genre, type, description, note, nbEpisodes, affiche); + + // Assert + Assert.Equal(nom, oeuvre.Nom); + Assert.Equal(genre, oeuvre.Genre); + Assert.Equal(type, oeuvre.Type); + Assert.Equal(description, oeuvre.Description); + Assert.Equal(note, oeuvre.Note); + Assert.Equal(nbEpisodes, oeuvre.NbEpisodes); + Assert.Equal(affiche, oeuvre.Affiche); + } + + [Fact] + public void Oeuvre_Constructor_WithRequiredParameters_ShouldSetPropertiesCorrectly() + { + // Arrange + string nom = "One Piece"; + string type = "TV Series"; + string description = "An epic adventure."; + int nbEpisodes = 1000; + string affiche = "onepiece.jpg"; + + // Act + Oeuvre oeuvre = new Oeuvre(nom, type, description, nbEpisodes, affiche); + + // Assert + Assert.Equal(nom, oeuvre.Nom); + Assert.Empty(oeuvre.Genre); + Assert.Equal(type, oeuvre.Type); + Assert.Equal(description, oeuvre.Description); + Assert.Equal(0, oeuvre.Note); + Assert.Equal(nbEpisodes, oeuvre.NbEpisodes); + Assert.Equal(affiche, oeuvre.Affiche); + } + + [Fact] + public void AjouterEpisode_ShouldIncreaseNbEpisodesByGivenAmount() + { + // Arrange + Oeuvre oeuvre = new Oeuvre("Naruto", "TV Series", "A ninja's journey.", 220, "evangelion.jpg"); + int nbEpisodesToAdd = 50; + int expectedNbEpisodes = oeuvre.NbEpisodes + nbEpisodesToAdd; + + // Act + oeuvre.AjouterEpisode(nbEpisodesToAdd); + + // Assert + Assert.Equal(expectedNbEpisodes, oeuvre.NbEpisodes); + } + + } +} From cc2b17e9c0b3cf446e2dc00e40d7216b6cac9dc0 Mon Sep 17 00:00:00 2001 From: HMatheo Date: Thu, 8 Jun 2023 21:14:50 +0200 Subject: [PATCH 13/15] UnitTest for IPersistanceManager works --- src/MangaMap/App.xaml.cs | 2 +- src/MangaMap/MangaMap.csproj | 1 + src/MangaMap/MangaMap.sln | 8 +- src/MangaMap/Views/loginAdminPage.xaml.cs | 2 +- src/MangaMap/Views/loginPage.xaml.cs | 2 +- src/{MangaMap => }/Stub/Stub.cs | 112 +++++++++---------- src/Stub/Stub.csproj | 13 +++ src/UnitTests/UnitTestIPersistanceManager.cs | 69 ++++++++++++ src/UnitTests/UnitTests.csproj | 3 +- 9 files changed, 151 insertions(+), 61 deletions(-) rename src/{MangaMap => }/Stub/Stub.cs (93%) create mode 100644 src/Stub/Stub.csproj create mode 100644 src/UnitTests/UnitTestIPersistanceManager.cs diff --git a/src/MangaMap/App.xaml.cs b/src/MangaMap/App.xaml.cs index 734d883..fcfac7e 100644 --- a/src/MangaMap/App.xaml.cs +++ b/src/MangaMap/App.xaml.cs @@ -1,5 +1,5 @@ using Models; -using MangaMap.Stub; +using Stub; using MangaMap.Views; using System.Diagnostics; diff --git a/src/MangaMap/MangaMap.csproj b/src/MangaMap/MangaMap.csproj index d11847b..e55c277 100644 --- a/src/MangaMap/MangaMap.csproj +++ b/src/MangaMap/MangaMap.csproj @@ -136,6 +136,7 @@ + \ No newline at end of file diff --git a/src/MangaMap/MangaMap.sln b/src/MangaMap/MangaMap.sln index 954526f..db3434e 100644 --- a/src/MangaMap/MangaMap.sln +++ b/src/MangaMap/MangaMap.sln @@ -7,7 +7,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MangaMap", "MangaMap.csproj EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Models", "..\Models\Models.csproj", "{D13B26C4-A575-4577-A735-0B04DC02BC85}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests", "..\UnitTests\UnitTests.csproj", "{6B675815-FEE2-49D0-BAF9-84ECD5116FF9}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTests", "..\UnitTests\UnitTests.csproj", "{6B675815-FEE2-49D0-BAF9-84ECD5116FF9}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Stub", "..\Stub\Stub.csproj", "{434D7C7C-2B01-44AA-8619-28D65657C47A}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -29,6 +31,10 @@ Global {6B675815-FEE2-49D0-BAF9-84ECD5116FF9}.Debug|Any CPU.Build.0 = Debug|Any CPU {6B675815-FEE2-49D0-BAF9-84ECD5116FF9}.Release|Any CPU.ActiveCfg = Release|Any CPU {6B675815-FEE2-49D0-BAF9-84ECD5116FF9}.Release|Any CPU.Build.0 = Release|Any CPU + {434D7C7C-2B01-44AA-8619-28D65657C47A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {434D7C7C-2B01-44AA-8619-28D65657C47A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {434D7C7C-2B01-44AA-8619-28D65657C47A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {434D7C7C-2B01-44AA-8619-28D65657C47A}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/MangaMap/Views/loginAdminPage.xaml.cs b/src/MangaMap/Views/loginAdminPage.xaml.cs index fe55a2d..32b56cf 100644 --- a/src/MangaMap/Views/loginAdminPage.xaml.cs +++ b/src/MangaMap/Views/loginAdminPage.xaml.cs @@ -1,7 +1,7 @@ namespace MangaMap.Views; using System.Text.RegularExpressions; using System.Threading.Tasks; -using MangaMap.Stub; +using Stub; using Models; /// diff --git a/src/MangaMap/Views/loginPage.xaml.cs b/src/MangaMap/Views/loginPage.xaml.cs index 0253dd9..91ab0fa 100644 --- a/src/MangaMap/Views/loginPage.xaml.cs +++ b/src/MangaMap/Views/loginPage.xaml.cs @@ -1,7 +1,7 @@ namespace MangaMap.Views; using System.Text.RegularExpressions; using System.Threading.Tasks; -using MangaMap.Stub; +using Stub; using Models; /// diff --git a/src/MangaMap/Stub/Stub.cs b/src/Stub/Stub.cs similarity index 93% rename from src/MangaMap/Stub/Stub.cs rename to src/Stub/Stub.cs index bb6327a..e552f59 100644 --- a/src/MangaMap/Stub/Stub.cs +++ b/src/Stub/Stub.cs @@ -1,56 +1,56 @@ -using Models; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace MangaMap.Stub -{ - /// - /// Classe de stub pour la gestion de la persistance des données. - /// - public class Stub : IPersistanceManager - { - /// - /// Charge un jeu de données en mémoire. - /// - /// Un tuple contenant la liste des oeuvres et la liste des utilisateurs. - public (ObservableCollection, List) chargeDonne() - { - ObservableCollection l1 = new ObservableCollection(); - List l2 = new List(); - - Utilisateur u1 = new Utilisateur("t", "Pseudo1", "t", "Jean", "Baptiste", 12); - Utilisateur u2 = new Utilisateur("s", "Pseudo2", "s", "Baptiste", "Jean", 12); - Utilisateur u3 = new Utilisateur("v", "Pseudo3", "v", "David", "Marc", 12); - List genres = new List(); - genres.Add("Action"); - genres.Add("Future"); - Oeuvre o1 = new Oeuvre("Evangelion", genres, "TV", "C'est une bonne série", 4, 150, "evangelion.jpg"); - Oeuvre o2 = new Oeuvre("[Oshi No Ko]", genres, "DVD", "A la fin il meurt", 2, 24, "oshinoko.png"); - Oeuvre o3 = new Oeuvre("One Piece", genres, "TV", "C'est la meilleur série du monde, regardez absolument", 2, 24, "onepiece.jpg"); - Oeuvre o4 = new Oeuvre("Naruto", genres, "DVD", "A la fin il meurt pas", 2, 24, "oshinoko.png"); - Oeuvre o5 = new Oeuvre("Vinland Saga", genres, "DVD", "A la fin il meurt peut-être", 2, 24, "oshinoko.png"); - Oeuvre o6 = new Oeuvre("Hell's Paradise", genres, "DVD", "A la fin j'espère il meurt pas", 2, 24, "oshinoko.png"); - - l1.Add(o1); l1.Add(o2); l1.Add(o3); l1.Add(o4); l1.Add(o5); l1.Add(o6); - l2.Add(u1); l2.Add(u2); l2.Add(u3); - - //u1.ListeOeuvreEnVisionnage.Add(o1); - - return (l1, l2); - } - - /// - /// Méthode non implémentée pour la sauvegarde des données. - /// - /// La liste des oeuvres à sauvegarder. - /// La liste des utilisateurs à sauvegarder. - public void sauvegarder(ObservableCollection o, List u) - { - throw new NotImplementedException(); - } - } -} +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Models; + +namespace Stub +{ + /// + /// Classe de stub pour la gestion de la persistance des données. + /// + public class Stub : IPersistanceManager + { + /// + /// Charge un jeu de données en mémoire. + /// + /// Un tuple contenant la liste des oeuvres et la liste des utilisateurs. + public (ObservableCollection, List) chargeDonne() + { + ObservableCollection l1 = new ObservableCollection(); + List l2 = new List(); + + Utilisateur u1 = new Utilisateur("t", "Pseudo1", "t", "Jean", "Baptiste", 12); + Utilisateur u2 = new Utilisateur("s", "Pseudo2", "s", "Baptiste", "Jean", 12); + Utilisateur u3 = new Utilisateur("v", "Pseudo3", "v", "David", "Marc", 12); + List genres = new List(); + genres.Add("Action"); + genres.Add("Future"); + Oeuvre o1 = new Oeuvre("Evangelion", genres, "TV", "C'est une bonne série", 4, 150, "evangelion.jpg"); + Oeuvre o2 = new Oeuvre("[Oshi No Ko]", genres, "DVD", "A la fin il meurt", 2, 24, "oshinoko.png"); + Oeuvre o3 = new Oeuvre("One Piece", genres, "TV", "C'est la meilleur série du monde, regardez absolument", 2, 24, "onepiece.jpg"); + Oeuvre o4 = new Oeuvre("Naruto", genres, "DVD", "A la fin il meurt pas", 2, 24, "oshinoko.png"); + Oeuvre o5 = new Oeuvre("Vinland Saga", genres, "DVD", "A la fin il meurt peut-être", 2, 24, "oshinoko.png"); + Oeuvre o6 = new Oeuvre("Hell's Paradise", genres, "DVD", "A la fin j'espère il meurt pas", 2, 24, "oshinoko.png"); + + l1.Add(o1); l1.Add(o2); l1.Add(o3); l1.Add(o4); l1.Add(o5); l1.Add(o6); + l2.Add(u1); l2.Add(u2); l2.Add(u3); + + //u1.ListeOeuvreEnVisionnage.Add(o1); + + return (l1, l2); + } + + /// + /// Méthode non implémentée pour la sauvegarde des données. + /// + /// La liste des oeuvres à sauvegarder. + /// La liste des utilisateurs à sauvegarder. + public void sauvegarder(ObservableCollection o, List u) + { + Console.WriteLine("Méthode sauvegarder() appelée."); + } + } +} diff --git a/src/Stub/Stub.csproj b/src/Stub/Stub.csproj new file mode 100644 index 0000000..e45d1d7 --- /dev/null +++ b/src/Stub/Stub.csproj @@ -0,0 +1,13 @@ + + + + net7.0 + enable + enable + + + + + + + diff --git a/src/UnitTests/UnitTestIPersistanceManager.cs b/src/UnitTests/UnitTestIPersistanceManager.cs new file mode 100644 index 0000000..1791065 --- /dev/null +++ b/src/UnitTests/UnitTestIPersistanceManager.cs @@ -0,0 +1,69 @@ +using Models; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Stub; + +namespace UnitTests +{ + public class UnitTestIPersistanceManager + { + [Fact] + public void ChargeDonne_ReturnsExpectedData() + { + // Arrange + var stub = new Stub.Stub(); + + // Act + var (oeuvres, utilisateurs) = stub.chargeDonne(); + + // Assert + Assert.NotNull(oeuvres); + Assert.NotNull(utilisateurs); + Assert.Equal(6, oeuvres.Count); + Assert.Equal(3, utilisateurs.Count); + + // Assert specific oeuvre properties + var evangelion = oeuvres[0]; + Assert.Equal("Evangelion", evangelion.Nom); + Assert.Collection(evangelion.Genre, + genre => Assert.Equal("Action", genre), + genre => Assert.Equal("Future", genre)); + Assert.Equal("TV", evangelion.Type); + Assert.Equal("C'est une bonne série", evangelion.Description); + Assert.Equal(4, evangelion.Note); + Assert.Equal(150, evangelion.NbEpisodes); + Assert.Equal("evangelion.jpg", evangelion.Affiche); + + // Assert specific utilisateur properties + var utilisateur = utilisateurs[0]; + Assert.Equal("t", utilisateur.Email); + Assert.Equal("Pseudo1", utilisateur.Pseudo); + Assert.Equal("t", utilisateur.MotDePasse); + Assert.Equal("Jean", utilisateur.nom); + Assert.Equal("Baptiste", utilisateur.prenom); + Assert.Equal(12, utilisateur.age); + } + + [Fact] + public void Sauvegarder_CallsConsoleWriteLine() + { + // Arrange + var stub = new Stub.Stub(); + var oeuvres = new ObservableCollection(); + var utilisateurs = new List(); + + // Act + stub.sauvegarder(oeuvres, utilisateurs); + + // Assert + // Since the implementation of Sauvegarder only calls Console.WriteLine, + // we can't directly test the functionality, but we can assert that the method was called + // You can check the console output manually to verify the expected message + } + } +} + diff --git a/src/UnitTests/UnitTests.csproj b/src/UnitTests/UnitTests.csproj index de864cf..ed48d31 100644 --- a/src/UnitTests/UnitTests.csproj +++ b/src/UnitTests/UnitTests.csproj @@ -1,4 +1,4 @@ - + net7.0 @@ -23,6 +23,7 @@ + From 16eaf21d4da407f93167b4609f6025b863462d04 Mon Sep 17 00:00:00 2001 From: HMatheo Date: Thu, 8 Jun 2023 21:19:21 +0200 Subject: [PATCH 14/15] Better unitTest --- src/MangaMap/MangaMap.csproj | 4 ++-- src/UnitTests/UnitTestIPersistanceManager.cs | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/MangaMap/MangaMap.csproj b/src/MangaMap/MangaMap.csproj index e55c277..8b91f47 100644 --- a/src/MangaMap/MangaMap.csproj +++ b/src/MangaMap/MangaMap.csproj @@ -1,11 +1,11 @@  - net7.0-android;net7.0-ios;net7.0-maccatalyst + net7.0; $(TargetFrameworks);net7.0-windows10.0.19041.0 - Exe + Exe MangaMap true true diff --git a/src/UnitTests/UnitTestIPersistanceManager.cs b/src/UnitTests/UnitTestIPersistanceManager.cs index 1791065..1f28fbd 100644 --- a/src/UnitTests/UnitTestIPersistanceManager.cs +++ b/src/UnitTests/UnitTestIPersistanceManager.cs @@ -62,7 +62,6 @@ namespace UnitTests // Assert // Since the implementation of Sauvegarder only calls Console.WriteLine, // we can't directly test the functionality, but we can assert that the method was called - // You can check the console output manually to verify the expected message } } } From 4bb605bf4ab8a55ca8d9aeb4910410ded20ed0e5 Mon Sep 17 00:00:00 2001 From: Matheo HERSAN Date: Thu, 8 Jun 2023 21:39:12 +0200 Subject: [PATCH 15/15] Update 'README.md' --- README.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/README.md b/README.md index a977fe1..f3e05ec 100644 --- a/README.md +++ b/README.md @@ -3,12 +3,6 @@ Vianney Jourdy (G9) Hersan Mathéo (G10) -[![Build Status](https://codefirst.iut.uca.fr/api/badges/antoine.perederii/Banquale/status.svg)](https://codefirst.iut.uca.fr/vianney.jourdy/MapManga) -[![Quality Gate Status](https://codefirst.iut.uca.fr/sonar/api/project_badges/measure?project=Banquale&metric=alert_status&token=1a49717e4d2f15e2eecaaa971ebd8c83fb9bd5c5)](https://codefirst.iut.uca.fr/sonar/dashboard?id=MangaMap) -[![Bugs](https://codefirst.iut.uca.fr/sonar/api/project_badges/measure?project=Banquale&metric=bugs&token=1a49717e4d2f15e2eecaaa971ebd8c83fb9bd5c5)](https://codefirst.iut.uca.fr/sonar/dashboard?id=MangaMap) -[![Coverage](https://codefirst.iut.uca.fr/sonar/api/project_badges/measure?project=Banquale&metric=coverage&token=1a49717e4d2f15e2eecaaa971ebd8c83fb9bd5c5)](https://codefirst.iut.uca.fr/sonar/dashboard?id=MangaMap) -[![Vulnerabilities](https://codefirst.iut.uca.fr/sonar/api/project_badges/measure?project=Banquale&metric=vulnerabilities&token=1a49717e4d2f15e2eecaaa971ebd8c83fb9bd5c5)](https://codefirst.iut.uca.fr/sonar/dashboard?id=MangaMap) - ## Overview MapManga is an application designed to help manga and anime fans manage their reading and viewing experience. If you are a manga and anime fan, MapManga is the perfect application for you.