Test Regles
continuous-integration/drone/push Build is passing Details

master
Pauline PRADY 1 year ago
parent 24e1182d66
commit 06206f1ef8

@ -73,7 +73,6 @@ namespace UnitTesting
int? joueurCourantAvant = (int?)fieldInfo.GetValue(regles);
Assert.NotNull(joueurCourantAvant);
joueurCourantAvant++;
if (joueurCourantAvant >= regles.NbJoueursMaximum)
joueurCourantAvant = 0;
@ -85,7 +84,7 @@ namespace UnitTesting
int? joueurCourantApres = (int?)fieldInfo.GetValue(regles);
Assert.NotNull(joueurCourantApres);
Assert.Equal(joueurCourantAvant, joueurCourantApres);
Assert.NotEqual(joueurCourantAvant, joueurCourantApres);
Assert.Equal("joueur2", joueurCourantSuivant.Nom);
}
@ -159,8 +158,27 @@ namespace UnitTesting
joueurCourant = null;
Assert.Null(joueurCourant);
joueurCourant = 1;
Assert.Equal(1, joueurCourant);
bool result = regles.EstTerminee();
Assert.False(result);
}
[Fact]
public void TestEstTermineeFalseJoueurCourantDiffDeZero()
{
ReglesClassiques regles = new ReglesClassiques();
regles.AjouterJoueur("joueur1");
regles.AjouterJoueur("joueur2");
regles.CommencerLaPartie();
Type type = typeof(ReglesClassiques);
FieldInfo? fieldInfo = type.GetField("joueurCourant", BindingFlags.NonPublic | BindingFlags.Instance);
Assert.NotNull(fieldInfo);
int? joueurCourant = (int?)fieldInfo.GetValue(regles);
joueurCourant = -1;
Assert.Equal(-1, joueurCourant);
bool result = regles.EstTerminee();

Loading…
Cancel
Save