|
|
@ -30,6 +30,37 @@ namespace UnitTesting
|
|
|
|
Assert.Throws<PartieNonCommenceeException>(() => regles.PasserLaMain());
|
|
|
|
Assert.Throws<PartieNonCommenceeException>(() => regles.PasserLaMain());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
|
|
|
public void TestPasserLaMain()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
ReglesClassiques regles = new ReglesClassiques();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
regles.AjouterJoueur("céleste");
|
|
|
|
|
|
|
|
regles.AjouterJoueur("pauline");
|
|
|
|
|
|
|
|
regles.CommencerLaPartie();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Type type = typeof(ReglesClassiques);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FieldInfo? fieldInfo = type.GetField("joueurCourant", BindingFlags.NonPublic | BindingFlags.Instance);
|
|
|
|
|
|
|
|
Assert.NotNull(fieldInfo);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int? joueurCourant = (int?) fieldInfo.GetValue(regles);
|
|
|
|
|
|
|
|
Assert.NotNull(joueurCourant);
|
|
|
|
|
|
|
|
Assert.Equal(0, joueurCourant);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
regles.PasserLaMain();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
joueurCourant = (int?)fieldInfo.GetValue(regles);
|
|
|
|
|
|
|
|
Assert.NotNull(joueurCourant);
|
|
|
|
|
|
|
|
Assert.Equal(1, joueurCourant);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
regles.PasserLaMain();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
joueurCourant = (int?)fieldInfo.GetValue(regles);
|
|
|
|
|
|
|
|
Assert.NotNull(joueurCourant);
|
|
|
|
|
|
|
|
Assert.Equal(0, joueurCourant)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
[Fact]
|
|
|
|
public void TestEstTermineeVictoire()
|
|
|
|
public void TestEstTermineeVictoire()
|
|
|
|
{
|
|
|
|
{
|
|
|
|