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

@ -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)
<br />
<div align="center">

@ -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)
{
int totalSoldeComtpe = 0;
foreach(Inscrit i in lesInscrits)
{
if(i == inscrit)
{
foreach(Banque b in i.LesBanques)
{
return 0;
totalSoldeComtpe = b.ListeDesComptes.Sum(x => Convert.ToInt32(x));
}
}
}
return totalSoldeComtpe;
}
public List<Banque> LoadBanqueId(string id)
{

@ -38,16 +38,31 @@ namespace Model
{
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;
}
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;
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;
}

@ -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<Banque> lesbanques)
: this(id, nom, mail, prenom, mdp, soldeTotal)

@ -21,6 +21,49 @@ namespace TestsUnitaires
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]
public void testSupprimerBanque()
{
@ -33,5 +76,8 @@ namespace TestsUnitaires
Assert.DoesNotContain(bq, i1.LesBanques);
}
}
}

Loading…
Cancel
Save