Test unitaire Compte

pull/138/head
Lucas EVARD 2 years ago
parent ab33f28138
commit 294bf73d9e

@ -33,16 +33,31 @@ namespace Model
Solde = solde;
DerniereModification = DateTime.Now;
}
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;
}

@ -21,17 +21,63 @@ 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()
{
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);
}
}
}

Loading…
Cancel
Save