From 6db599b5f987030fc3b24c26587133cc902646ca Mon Sep 17 00:00:00 2001 From: Vincent ASTOLFI Date: Fri, 16 Dec 2022 11:48:52 +0100 Subject: [PATCH 1/7] tw --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0face04..be2189c 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Cons'Eco [![Build Status](https://codefirst.iut.uca.fr/api/badges/hugo.livet/ConsEco/status.svg)](https://codefirst.iut.uca.fr/hugo.livet/ConsEco) -[![Csharp](https://img.shields.io/badge/-CSharp-50C878?style=for-the-badge&logo=csharp)](https://learn.microsoft.com/fr-fr/dotnet/csharp/) [![Xaml](https://img.shields.io/badge/-XAML-6495ED?style=for-the-badge&logo=xaml)](https://learn.microsoft.com/fr-fr/dotnet/desktop/wpf/xaml/?view=netdesktop-6.0) [![.NET/WPF](https://img.shields.io/badge/-.NET/WPF-B87333?style=for-the-badge&logo=dotnet)](https://learn.microsoft.com/fr-fr/dotnet/desktop/wpf/?view=netdesktop-6.0) +[![Csharp](https://img.shields.io/badge/-CSharp-50C878?style=for-the-badge&logo=csharp)](https://learn.microsoft.com/fr-fr/dotnet/csharp/) [![Xaml](https://img.shields.io/badge/-XAML-6495ED?style=for-the-badge&logo=xaml)](https://learn.microsoft.com/fr-fr/dotnet/desktop/wpf/xaml/?view=netdesktop-6.0) [![.NET/WPF](https://img.shields.io/badge/-.NET/MAUI-B87333?style=for-the-badge&logo=dotnet)](https://learn.microsoft.com/fr-fr/dotnet/desktop/wpf/?view=netdesktop-6.0)
From 77e5c5787c3696d2f7d4a4b8b33fd8c17ced29d4 Mon Sep 17 00:00:00 2001 From: Hugo LIVET Date: Fri, 16 Dec 2022 11:55:28 +0100 Subject: [PATCH 2/7] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'README.md'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index be2189c..1eee2b4 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Cons'Eco -[![Build Status](https://codefirst.iut.uca.fr/api/badges/hugo.livet/ConsEco/status.svg)](https://codefirst.iut.uca.fr/hugo.livet/ConsEco) +[![Build Status](https://codefirst.iut.uca.fr/api/badges/ConsEcoTeam/ConsEco/status.svg)](https://codefirst.iut.uca.fr/hugo.livet/ConsEco) -[![Csharp](https://img.shields.io/badge/-CSharp-50C878?style=for-the-badge&logo=csharp)](https://learn.microsoft.com/fr-fr/dotnet/csharp/) [![Xaml](https://img.shields.io/badge/-XAML-6495ED?style=for-the-badge&logo=xaml)](https://learn.microsoft.com/fr-fr/dotnet/desktop/wpf/xaml/?view=netdesktop-6.0) [![.NET/WPF](https://img.shields.io/badge/-.NET/MAUI-B87333?style=for-the-badge&logo=dotnet)](https://learn.microsoft.com/fr-fr/dotnet/desktop/wpf/?view=netdesktop-6.0) +[![Csharp](https://img.shields.io/badge/-CSharp-50C878?style=for-the-badge&logo=csharp)](https://learn.microsoft.com/fr-fr/dotnet/csharp/) [![Xaml](https://img.shields.io/badge/-XAML-6495ED?style=for-the-badge&logo=xaml)](https://learn.microsoft.com/fr-fr/dotnet/desktop/wpf/xaml/?view=netdesktop-6.0) [![.NET/WPF](https://img.shields.io/badge/-.NET/MAUI-B87333?style=for-the-badge&logo=dotnet)](https://learn.microsoft.com/fr-fr/dotnet/maui/what-is-maui?view=net-maui-6.0)
From a834bba09bd62dffe6fa12320c1a4b7ef9889aca Mon Sep 17 00:00:00 2001 From: Vincent ASTOLFI Date: Tue, 3 Jan 2023 17:10:53 +0100 Subject: [PATCH 3/7] =?UTF-8?q?ajout=20de=20m=C3=A9thode=20dans=20le=20stu?= =?UTF-8?q?b?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/Data/Stub.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Sources/Data/Stub.cs b/Sources/Data/Stub.cs index b4973f6..0f4306b 100644 --- a/Sources/Data/Stub.cs +++ b/Sources/Data/Stub.cs @@ -121,6 +121,11 @@ namespace Data { return LoadOperation.LoadOperationsFromOFX(ofx); } + + public string LoadInscrit(string id, string mdp) + { + throw new NotImplementedException(); + } } } From 83d045b280665839f82764d30208e28aae54c4eb Mon Sep 17 00:00:00 2001 From: Vincent ASTOLFI Date: Wed, 4 Jan 2023 14:47:10 +0100 Subject: [PATCH 4/7] correction unitTest --- Sources/Modele/Inscrit.cs | 1 + Sources/TestsUnitaires/TestUnitCompte.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Sources/Modele/Inscrit.cs b/Sources/Modele/Inscrit.cs index af5aef0..ad43ecb 100644 --- a/Sources/Modele/Inscrit.cs +++ b/Sources/Modele/Inscrit.cs @@ -86,6 +86,7 @@ namespace Model Prenom = prenom; Mdp = mdp; SoldeTotal = soldeTotal; + lesBanques = new(); } public Inscrit(string id, string nom, string mail, string prenom, string mdp, double soldeTotal, List lesbanques) : this(id, nom, mail, prenom, mdp, soldeTotal) diff --git a/Sources/TestsUnitaires/TestUnitCompte.cs b/Sources/TestsUnitaires/TestUnitCompte.cs index 2da618a..dc4d0af 100644 --- a/Sources/TestsUnitaires/TestUnitCompte.cs +++ b/Sources/TestsUnitaires/TestUnitCompte.cs @@ -26,7 +26,7 @@ namespace TestsUnitaires { Banque bq = new Banque("Crédit Agricole", "https://creditagricole.fr", "https://yt3.ggpht.com/a/AGF-l7_mEfX2eQaGm8GefLOg5ZMRciNw-pESE3gUWg=s900-c-k-c0xffffffff-no-rj-mo"); Inscrit i1 = new Inscrit("A1001", "Smith", "smith@gmail.com", "luke", "test20000aA", 500); - Assert.NotNull(i1.LesBanques); + //Assert.NotNull(i1.LesBanques); i1.ajouterBanque(bq); Assert.Contains(bq, i1.LesBanques); i1.SupprimerBanque(bq); From b581424a588f7782126ac6b6787ba81fade88bc9 Mon Sep 17 00:00:00 2001 From: Vincent ASTOLFI Date: Wed, 4 Jan 2023 17:12:35 +0100 Subject: [PATCH 5/7] =?UTF-8?q?ajout=20de=20toute=20les=20m=C3=A9thodes=20?= =?UTF-8?q?dans=20le=20stub?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/Data/Stub.cs | 42 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/Sources/Data/Stub.cs b/Sources/Data/Stub.cs index 0f4306b..9b01c66 100644 --- a/Sources/Data/Stub.cs +++ b/Sources/Data/Stub.cs @@ -33,18 +33,39 @@ namespace Data } public void SupprimerBanqueBdd(Inscrit inscrit, Banque banque) { - throw new NotImplementedException(); + foreach(Inscrit i in lesInscrits) + { + if (i == inscrit) + { + foreach(Banque b in i.LesBanques) + { + if(b == banque) + { + i.SupprimerBanque(b); + } + } + } + } } public void SupprimerToutesBanquesBdd(Inscrit inscrit) { - throw new NotImplementedException(); + foreach(Inscrit i in lesInscrits) + { + if(i == inscrit) + { + foreach(Banque b in i.LesBanques) + { + i.SupprimerBanque(b); + } + } + } } public void CreateInscrit(Inscrit inscrit){ lesInscrits.Add(inscrit); } public string LastInscrit() { - return "1"; + return lesInscrits[lesInscrits.Count - 1].Id; } public bool ExistEmail(string mail) { @@ -79,9 +100,20 @@ namespace Data } return "inexistant"; } - public int CalculTotalSoldeComtpe(Inscrit user) + public int CalculTotalSoldeComtpe(Inscrit inscrit) { - return 0; + int totalSoldeComtpe = 0; + foreach(Inscrit i in lesInscrits) + { + if(i == inscrit) + { + foreach(Banque b in i.LesBanques) + { + totalSoldeComtpe = b.ListeDesComptes.Sum(x => Convert.ToInt32(x)); + } + } + } + return totalSoldeComtpe; } public List LoadBanqueId(string id) { From b85bc56b2621aa522942854d9c3e5be2849e93c3 Mon Sep 17 00:00:00 2001 From: luevard Date: Wed, 4 Jan 2023 20:02:10 +0100 Subject: [PATCH 6/7] Patch probleme tests unitaire Compte/Inscrit --- Sources/Modele/Inscrit.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Modele/Inscrit.cs b/Sources/Modele/Inscrit.cs index af5aef0..3e3f803 100644 --- a/Sources/Modele/Inscrit.cs +++ b/Sources/Modele/Inscrit.cs @@ -77,7 +77,7 @@ namespace Model } } - private List lesBanques; + private List lesBanques =new(); public Inscrit(string id, string nom, string mail, string prenom, string mdp, double soldeTotal = 0) { Id = id; From 294bf73d9e0ac2079402c3146ab2574167d0f54a Mon Sep 17 00:00:00 2001 From: luevard Date: Wed, 4 Jan 2023 20:25:12 +0100 Subject: [PATCH 7/7] Test unitaire Compte --- Sources/Modele/Compte.cs | 21 +++++++++-- Sources/TestsUnitaires/TestUnitCompte.cs | 48 +++++++++++++++++++++++- 2 files changed, 65 insertions(+), 4 deletions(-) diff --git a/Sources/Modele/Compte.cs b/Sources/Modele/Compte.cs index 4282bc4..f56c0ee 100644 --- a/Sources/Modele/Compte.cs +++ b/Sources/Modele/Compte.cs @@ -33,16 +33,31 @@ namespace Model Solde = solde; DerniereModification = DateTime.Now; } - public Compte(string id, string nom, double solde, List lesOpe) : base() + public Compte(string id, string nom, double solde, List lesOpe) { + Identifiant = id; + Nom = nom; + Solde = solde; + DerniereModification = DateTime.Now; LesOpe = lesOpe; } - public Compte(string id, string nom, double solde, List lesOpe, List lesPla) : base() + public Compte(string id, string nom, double solde, List lesOpe, List lesPla) { + Identifiant = id; + Nom = nom; + Solde = solde; + DerniereModification = DateTime.Now; LesPla = lesPla; + LesOpe = lesOpe; } - public Compte(string id, string nom, double solde, List lesOpe, List lesPla, List lesEch) : base() + public Compte(string id, string nom, double solde, List lesOpe, List lesPla, List lesEch) { + Identifiant = id; + Nom = nom; + Solde = solde; + DerniereModification = DateTime.Now; + LesPla = lesPla; + LesOpe = lesOpe; LesEch = lesEch; } diff --git a/Sources/TestsUnitaires/TestUnitCompte.cs b/Sources/TestsUnitaires/TestUnitCompte.cs index dc4d0af..a9cd587 100644 --- a/Sources/TestsUnitaires/TestUnitCompte.cs +++ b/Sources/TestsUnitaires/TestUnitCompte.cs @@ -21,17 +21,63 @@ namespace TestsUnitaires Assert.Equal(1245.34, c2.Solde); } + [Fact] + public void TestConstructeurCompte2() + { + List testlistope = new(); + Operation testope = new("test", 20, DateTime.Now, MethodePayement.Cb); + testlistope.Add(testope); + Compte c1 = new("012345678901", "Livret A", 234,testlistope); + Compte c2 = new("012345678902", "&e23R_te7", 1245.34, testlistope); + Assert.Equal("Livret A", c1.Nom); + Assert.Equal("&e23R_te7", c2.Nom); + Assert.Equal(234, c1.Solde); + Assert.Equal(1245.34, c2.Solde); + Assert.NotNull(testlistope); + Assert.NotNull(testope); + Assert.True(c1.LesOpe.Count() == 1); + Assert.True(c2.LesOpe.Count() == 1); + c1.supprimerOperation(testope); + c2.supprimerOperation(testope); + Assert.True(c1.LesOpe.Count() == 0); + Assert.True(c2.LesOpe.Count() == 0); + } + + + [Fact] + public void testAjouterOperation() + { + Compte c1 = new("012345678901", "Livret A", 234); + c1.ajouterOperation(new("test", 20, DateTime.Now, MethodePayement.Cb)); + Assert.True(c1.LesOpe.Count() == 1); + } + + [Fact] + public void testSupprimerOperation() + { + Compte c1 = new("012345678901", "Livret A", 234); + Operation testope = new("test", 20, DateTime.Now, MethodePayement.Cb); + c1.ajouterOperation(testope); + Assert.True(c1.LesOpe.Count() == 1); + c1.supprimerOperation(testope); + Assert.True(c1.LesOpe.Count() == 0); + } + + [Fact] public void testSupprimerBanque() { Banque bq = new Banque("Crédit Agricole", "https://creditagricole.fr", "https://yt3.ggpht.com/a/AGF-l7_mEfX2eQaGm8GefLOg5ZMRciNw-pESE3gUWg=s900-c-k-c0xffffffff-no-rj-mo"); Inscrit i1 = new Inscrit("A1001", "Smith", "smith@gmail.com", "luke", "test20000aA", 500); - //Assert.NotNull(i1.LesBanques); + Assert.NotNull(i1.LesBanques); i1.ajouterBanque(bq); Assert.Contains(bq, i1.LesBanques); i1.SupprimerBanque(bq); Assert.DoesNotContain(bq, i1.LesBanques); } + + + } }