pull/138/head
Hugo LIVET 2 years ago
commit d4cd93bc97

@ -1,7 +1,7 @@
# Cons'Eco # 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)
<br /> <br />
<div align="center"> <div align="center">

@ -33,18 +33,39 @@ namespace Data
} }
public void SupprimerBanqueBdd(Inscrit inscrit, Banque banque) 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) 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){ public void CreateInscrit(Inscrit inscrit){
lesInscrits.Add(inscrit); lesInscrits.Add(inscrit);
} }
public string LastInscrit() public string LastInscrit()
{ {
return "1"; return lesInscrits[lesInscrits.Count - 1].Id;
} }
public bool ExistEmail(string mail) public bool ExistEmail(string mail)
{ {
@ -79,9 +100,20 @@ namespace Data
} }
return "inexistant"; 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<Banque> LoadBanqueId(string id) public List<Banque> LoadBanqueId(string id)
{ {

@ -38,16 +38,31 @@ namespace Model
{ {
Solde = solde; Solde = solde;
} }
public Compte(string id, string nom, double solde, List<Operation> lesOpe) : base() public Compte(string id, string nom, double solde, List<Operation> lesOpe)
{ {
Identifiant = id;
Nom = nom;
Solde = solde;
DerniereModification = DateTime.Now;
LesOpe = lesOpe; LesOpe = lesOpe;
} }
public Compte(string id, string nom, double solde, List<Operation> lesOpe, List<Planification> lesPla) : base() public Compte(string id, string nom, double solde, List<Operation> lesOpe, List<Planification> lesPla)
{ {
Identifiant = id;
Nom = nom;
Solde = solde;
DerniereModification = DateTime.Now;
LesPla = lesPla; LesPla = lesPla;
LesOpe = lesOpe;
} }
public Compte(string id, string nom, double solde, List<Operation> lesOpe, List<Planification> lesPla, List<Echeance> lesEch) : base() public Compte(string id, string nom, double solde, List<Operation> lesOpe, List<Planification> lesPla, List<Echeance> lesEch)
{ {
Identifiant = id;
Nom = nom;
Solde = solde;
DerniereModification = DateTime.Now;
LesPla = lesPla;
LesOpe = lesOpe;
LesEch = lesEch; LesEch = lesEch;
} }

@ -90,6 +90,7 @@ namespace Model
Prenom = prenom; Prenom = prenom;
Mdp = mdp; Mdp = mdp;
SoldeTotal = soldeTotal; SoldeTotal = soldeTotal;
lesBanques = new();
} }
public Inscrit(int id, string nom, string mail, string prenom, string mdp, double soldeTotal, List<Banque> lesbanques) public Inscrit(int id, string nom, string mail, string prenom, string mdp, double soldeTotal, List<Banque> lesbanques)
: this(id, nom, mail, prenom, mdp, soldeTotal) : this(id, nom, mail, prenom, mdp, soldeTotal)

@ -21,6 +21,49 @@ namespace TestsUnitaires
Assert.Equal(1245.34, c2.Solde); Assert.Equal(1245.34, c2.Solde);
} }
[Fact]
public void TestConstructeurCompte2()
{
List<Operation> 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] [Fact]
public void testSupprimerBanque() public void testSupprimerBanque()
{ {
@ -33,5 +76,8 @@ namespace TestsUnitaires
Assert.DoesNotContain(bq, i1.LesBanques); Assert.DoesNotContain(bq, i1.LesBanques);
} }
} }
} }

Loading…
Cancel
Save