Nicolas MAYE 2 years ago
commit e0e52c266c

@ -11,7 +11,7 @@ namespace Model
public string Nom { get; private set; }
public string UrlSite { get; private set; }
public string UrlLogo { get; private set; }
public List<Compte> ListeDesComptes { get; private set; }
public List<Compte> ListeDesComptes { get; private set; } = new List<Compte>();
public Banque(string nom, string urlSite, string urlLogo)
{
@ -28,14 +28,33 @@ namespace Model
ListeDesComptes = lescomptes;
}
private void AjouterCompte(Compte compte)
public void AjouterCompte(Compte compte)
{
ListeDesComptes.Add(compte);
}
private void SupprimerCompte(Compte compte)
public void SupprimerCompte(Compte compte)
{
ListeDesComptes.Remove(compte);
}
public bool ExisteCompte(string s)
{
foreach (Compte compte in ListeDesComptes)
{
if (compte.Nom.Equals(s))
return true;
}
return false;
}
public Compte ReturnCompte(string s)
{
foreach (Compte compte in ListeDesComptes)
{
if (compte.Nom.Equals(s))
return compte;
}
throw new KeyNotFoundException();
}
}
}

@ -1,54 +1,54 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//using Banque;
namespace Model
{
public class Inscrit
{
public Inscrit(string id, string nom, string mail, string prenom, string mdp, double soldeTotal)
{
Id = id;
Nom = nom;
Mail = mail;
Prenom = prenom;
Mdp = mdp;
SoldeTotal = soldeTotal;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//using Banque;
namespace Model
{
public class Inscrit
{
public Inscrit(string id, string nom, string mail, string prenom, string mdp, double soldeTotal)
{
Id = id;
Nom = nom;
Mail = mail;
Prenom = prenom;
Mdp = mdp;
SoldeTotal = soldeTotal;
}
public Inscrit(string id, string nom, string mail, string prenom, string mdp, double soldeTotal,List<Banque>lesbanques)
{
Id = id;
Nom = nom;
Mail = mail;
Prenom = prenom;
Mdp = mdp;
SoldeTotal = soldeTotal;
LesBanques = lesbanques;
}
public string Id { get; private set; }
public string Nom { get; private set; }
public string Mail { get; private set; }
public string Prenom { get; private set; }
public string Mdp { get; private set; }
public double SoldeTotal { get; private set; }
public Devises Dev { get; private set; }
private List<Banque> LesBanques { get; set; }
/*public void ajouterBanque(Banque b)
{
TouteLesBanques.Add(b);
}
public void ajouterBanque(Banque b)
{
TouteLesBanques.Remove(b);
}*/
public void ChoisirDevise(Devises devise)
{
Dev = devise;
}
}
}
public Inscrit(string id, string nom, string mail, string prenom, string mdp, double soldeTotal,List<Banque>lesbanques)
{
Id = id;
Nom = nom;
Mail = mail;
Prenom = prenom;
Mdp = mdp;
SoldeTotal = soldeTotal;
LesBanques = lesbanques;
}
public string Id { get; private set; }
public string Nom { get; private set; }
public string Mail { get; private set; }
public string Prenom { get; private set; }
public string Mdp { get; private set; }
public double SoldeTotal { get; private set; }
public Devises Dev { get; private set; }
private List<Banque> LesBanques { get; set; }
/*public void ajouterBanque(Banque b)
{
TouteLesBanques.Add(b);
}
public void ajouterBanque(Banque b)
{
TouteLesBanques.Remove(b);
}*/
public void ChoisirDevise(Devises devise)
{
Dev = devise;
}
}
}

@ -11,6 +11,8 @@ namespace Model
public List<Banque> Banques = new();
public List<Inscrit> Inscrits = new();
public List<Compte> Comptes = new();
// ajouter load all pour tout les inscrits
public List<Inscrit> LoadInscrit()
{
Inscrits.Add(new("00001", "Evard", "lucasevard@gmail.com","Lucas","test",10,LoadBanques()));

@ -0,0 +1,58 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Model;
namespace TestsUnitaires
{
public class TestUnitBanque
{
Banque test = new("BNP Paribas", "https://mabanque.bnpparibas/", "https://logos-marques.com/wp-content/uploads/2020/12/BNP-Paribas-logo.png");
Banque test2 = new("BNP Paribas", "https://mabanque.bnpparibas/", "https://logos-marques.com/wp-content/uploads/2020/12/BNP-Paribas-logo.png", listeCompte);
[Fact]
public void testConstructeur1()
{
Assert.NotNull(test);
Assert.Equal("BNP Paribas", test.Nom);
Assert.NotEqual("https://mabanque.bnpparibas/", test.Nom);
Assert.Equal("https://mabanque.bnpparibas/", test.UrlSite);
Assert.Equal("https://logos-marques.com/wp-content/uploads/2020/12/BNP-Paribas-logo.png", test.UrlLogo);
}
[Fact]
public void testConstructeur2()
{
List<Compte> listeCompte = new();
Compte tc = new("Livret A", 16956);
listeCompte.Add(tc);
Assert.NotNull(test2);
Assert.NotNull(test2.ListeDesComptes);
Assert.Equal("BNP Paribas", test.Nom);
Assert.NotEqual("https://mabanque.bnpparibas/", test2.Nom);
Assert.Equal("https://mabanque.bnpparibas/", test2.UrlSite);
Assert.Equal("https://logos-marques.com/wp-content/uploads/2020/12/BNP-Paribas-logo.png", test2.UrlLogo);
Assert.Contains(tc, test2.ListeDesComptes);
}
[Fact]
public void testAjouterCompte()
{
Compte tc = new("Livret A", 16956);
Assert.NotNull(test.ListeDesComptes);
test.AjouterCompte(tc);
Assert.Contains(tc, test.ListeDesComptes);
}
[Fact]
public void testSupprimerCompte()
{
Compte tc = new("Livret A", 16956);
Assert.NotNull(test.ListeDesComptes);
test.AjouterCompte(tc);
Assert.Contains(tc, test.ListeDesComptes);
test.SupprimerCompte(tc);
Assert.DoesNotContain(tc, test.ListeDesComptes);
}
}
}
Loading…
Cancel
Save