Tests
continuous-integration/drone/push Build is failing Details

master
Pauline PRADY 11 months ago
parent 06206f1ef8
commit 33fea210d0

@ -2,6 +2,8 @@
using CoreLibrary.Regles; using CoreLibrary.Regles;
using CoreLibrary.Core; using CoreLibrary.Core;
using Xunit; using Xunit;
using System.Reflection;
using CoreLibrary.Events;
namespace UnitTesting namespace UnitTesting
{ {
@ -164,5 +166,39 @@ namespace UnitTesting
partie.Jouer(); partie.Jouer();
Assert.True(eventAppelle); Assert.True(eventAppelle);
} }
[Fact]
public void TestCreerCodeJetonNull()
{
IRegles regles = new ReglesClassiques();
Partie partie = new Partie(regles);
//Type type = typeof(Partie);
//FieldInfo? fieldInfo = type.GetField("CreerCode(Code code)", BindingFlags.NonPublic | BindingFlags.Instance);
//Assert.NotNull(fieldInfo);
//Code? codeSecret = (Code?)fieldInfo.GetValue(plateau);
//Assert.NotNull(codeSecret);
//plateau.AjouterCode(codeSecret);
//Assert.True(plateau.Victoire);
}
[Fact]
public void TestQuandSupprimerDernierJeton()
{
IRegles regles = new ReglesClassiques();
Partie partie = new Partie(regles);
bool eventAppelle = false;
partie.SupprimerDernierJeton += (sender, e) =>
{
eventAppelle = true;
};
partie.Jouer();
Assert.True(eventAppelle);
}
} }
} }

@ -84,6 +84,8 @@ namespace UnitTesting
int? joueurCourantApres = (int?)fieldInfo.GetValue(regles); int? joueurCourantApres = (int?)fieldInfo.GetValue(regles);
Assert.NotNull(joueurCourantApres); Assert.NotNull(joueurCourantApres);
Assert.Equal(joueurCourantAvant, joueurCourantApres-1);
Assert.Equal(joueurCourantAvant+1, joueurCourantApres);
Assert.NotEqual(joueurCourantAvant, joueurCourantApres); Assert.NotEqual(joueurCourantAvant, joueurCourantApres);
Assert.Equal("joueur2", joueurCourantSuivant.Nom); Assert.Equal("joueur2", joueurCourantSuivant.Nom);
} }

Loading…
Cancel
Save