|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
using CoreLibrary.Core;
|
|
|
|
|
using CoreLibrary;
|
|
|
|
|
using CoreLibrary.Core;
|
|
|
|
|
using CoreLibrary.Exceptions;
|
|
|
|
|
using CoreLibrary.Joueurs;
|
|
|
|
|
using CoreLibrary.Regles;
|
|
|
|
@ -41,21 +42,25 @@ namespace UnitTesting
|
|
|
|
|
public void TestGagants()
|
|
|
|
|
{
|
|
|
|
|
ReglesClassiques regles = new ReglesClassiques();
|
|
|
|
|
Joueur j1 = regles.AjouterJoueur("céleste");
|
|
|
|
|
regles.AjouterJoueur("pauline");
|
|
|
|
|
Partie partie = new Partie(regles);
|
|
|
|
|
|
|
|
|
|
regles.AjouterJoueur("joueur1");
|
|
|
|
|
regles.AjouterJoueur("joueur2");
|
|
|
|
|
|
|
|
|
|
regles.CommencerLaPartie();
|
|
|
|
|
|
|
|
|
|
Plateau p = j1.Plateau;
|
|
|
|
|
Plateau plateauj1 = regles.JoueurCourant().Plateau;
|
|
|
|
|
|
|
|
|
|
FieldInfo? fieldInfo = typeof(Plateau).GetField("codeSecret", BindingFlags.NonPublic | BindingFlags.Instance);
|
|
|
|
|
Type type = typeof(Plateau);
|
|
|
|
|
FieldInfo? fieldInfo = type.GetField("codeSecret", BindingFlags.NonPublic | BindingFlags.Instance);
|
|
|
|
|
Assert.NotNull(fieldInfo);
|
|
|
|
|
Code? codeSecret = (Code?) fieldInfo.GetValue(p);
|
|
|
|
|
Code? codeSecret = (Code?)fieldInfo.GetValue(plateauj1);
|
|
|
|
|
Assert.NotNull(codeSecret);
|
|
|
|
|
|
|
|
|
|
p.AjouterCode(codeSecret);
|
|
|
|
|
|
|
|
|
|
Assert.True(regles.EstTerminee());
|
|
|
|
|
regles.JoueurCourant().Plateau.AjouterCode(codeSecret);
|
|
|
|
|
IEnumerable<Joueur> gagnants = regles.Gagnants();
|
|
|
|
|
Assert.Single(gagnants);
|
|
|
|
|
Assert.Contains(regles.JoueurCourant(), gagnants);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|