using données; using notre_bibliotheque; using System; using System.Collections.Generic; using System.Text; using Xunit; namespace tests_unitaires { public class GestionaireDeComptesUnitTest { [Fact] public void TestConstructeurParDefaut() { Gestionaire.Percistance = new Stub(""); GestionaireDeComptes gestionaireDeTest = new GestionaireDeComptes(); Assert.Equal(0, gestionaireDeTest.ItemsComptes.LesItems.Count); Assert.Null(gestionaireDeTest.ItemsComptes.ItemCourant); } [Fact] public void TestContructeurAvecItems() { IPercistance stb = new Stub(""); IEnumerable lesLangs = stb.ChargerLesDonnées()["Comtpes"]; Items its = new Items(lesLangs as IList); Gestionaire.Percistance = stb; GestionaireDeComptes gestionaireDeTest = new GestionaireDeComptes(its); Assert.Equal(its, gestionaireDeTest.ItemsComptes); Assert.Null(gestionaireDeTest.ItemsComptes.ItemCourant); } [Fact] public void testComptes() { IPercistance stb = new Stub(""); Gestionaire.Percistance = stb; GestionaireDeComptes gestionaireDeTest = new GestionaireDeComptes(); gestionaireDeTest.ChargerLesComptes(); try { Compte compteValide = gestionaireDeTest.VerfierCreationCompte("compte qui n'existe pas", "mot de passe", "mot de passe", false); Assert.Contains(new Compte("compte qui n'existe pas", "mot de passe"), gestionaireDeTest.ItemsComptes.LesItems); } catch (Exception e) { Console.WriteLine(e.Message); } } } }