diff --git a/README.md b/README.md
index 0face04..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/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/maui/what-is-maui?view=net-maui-6.0)
diff --git a/Sources/Data/PersStub.cs b/Sources/Data/PersStub.cs
index e209d82..6f2b2ca 100644
--- a/Sources/Data/PersStub.cs
+++ b/Sources/Data/PersStub.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)
{
diff --git a/Sources/Modele/Compte.cs b/Sources/Modele/Compte.cs
index 85a7bc6..67654a6 100644
--- a/Sources/Modele/Compte.cs
+++ b/Sources/Modele/Compte.cs
@@ -38,16 +38,31 @@ namespace Model
{
Solde = solde;
}
- 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/Modele/Inscrit.cs b/Sources/Modele/Inscrit.cs
index 59c1163..00c7d0e 100644
--- a/Sources/Modele/Inscrit.cs
+++ b/Sources/Modele/Inscrit.cs
@@ -90,6 +90,7 @@ namespace Model
Prenom = prenom;
Mdp = mdp;
SoldeTotal = soldeTotal;
+ lesBanques = new();
}
public Inscrit(int 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 bb5b514..41312ec 100644
--- a/Sources/TestsUnitaires/TestUnitCompte.cs
+++ b/Sources/TestsUnitaires/TestUnitCompte.cs
@@ -21,6 +21,49 @@ 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()
{
@@ -33,5 +76,8 @@ namespace TestsUnitaires
Assert.DoesNotContain(bq, i1.LesBanques);
}
+
+
+
}
}