You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.8 KiB
52 lines
1.8 KiB
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<Item> lesLangs = stb.ChargerLesDonnées()["Comtpes"];
|
|
Items its = new Items(lesLangs as IList<Item>);
|
|
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);
|
|
}
|
|
}
|
|
}
|
|
}
|