|
|
|
@ -28,30 +28,28 @@ namespace UnitTesting
|
|
|
|
|
{
|
|
|
|
|
ReglesClassiques regles = new ReglesClassiques();
|
|
|
|
|
Assert.Throws<PartieNonCommenceeException>(() => regles.PasserLaMain());
|
|
|
|
|
|
|
|
|
|
Type type = typeof(ReglesClassiques);
|
|
|
|
|
|
|
|
|
|
FieldInfo? fieldInfo = type.GetField("joueurCourant", BindingFlags.NonPublic | BindingFlags.Instance);
|
|
|
|
|
Assert.NotNull(fieldInfo);
|
|
|
|
|
|
|
|
|
|
int? joueurCourant = (int?)fieldInfo.GetValue(regles);
|
|
|
|
|
Assert.Null(joueurCourant);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[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);
|
|
|
|
|
|
|
|
|
|
regles.AjouterJoueur("céleste");
|
|
|
|
|
regles.AjouterJoueur("pauline");
|
|
|
|
|
|
|
|
|
|
Assert.Throws<PartieNonCommenceeException>(() => regles.PasserLaMain());
|
|
|
|
|
|
|
|
|
|
int? joueurCourantPasDemarree = (int?)fieldInfo.GetValue(regles);
|
|
|
|
|
Assert.Null(joueurCourantPasDemarree);
|
|
|
|
|
|
|
|
|
|
regles.CommencerLaPartie();
|
|
|
|
|
|
|
|
|
|
int? joueurCourantAvant = (int?) fieldInfo.GetValue(regles);
|
|
|
|
|
Assert.NotNull(joueurCourantAvant);
|
|
|
|
|
Assert.Equal(0, joueurCourantAvant);
|
|
|
|
|