diff --git a/Sources/UnitTesting/PartieUT.cs b/Sources/UnitTesting/PartieUT.cs index 6c62f38..9ff57e9 100644 --- a/Sources/UnitTesting/PartieUT.cs +++ b/Sources/UnitTesting/PartieUT.cs @@ -2,6 +2,8 @@ using CoreLibrary.Regles; using CoreLibrary.Core; using Xunit; +using System.Reflection; +using CoreLibrary.Events; namespace UnitTesting { @@ -164,5 +166,39 @@ namespace UnitTesting partie.Jouer(); 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); + } } } diff --git a/Sources/UnitTesting/ReglesClassiquesUT.cs b/Sources/UnitTesting/ReglesClassiquesUT.cs index e80bb8c..dba5535 100644 --- a/Sources/UnitTesting/ReglesClassiquesUT.cs +++ b/Sources/UnitTesting/ReglesClassiquesUT.cs @@ -84,6 +84,8 @@ namespace UnitTesting int? joueurCourantApres = (int?)fieldInfo.GetValue(regles); Assert.NotNull(joueurCourantApres); + Assert.Equal(joueurCourantAvant, joueurCourantApres-1); + Assert.Equal(joueurCourantAvant+1, joueurCourantApres); Assert.NotEqual(joueurCourantAvant, joueurCourantApres); Assert.Equal("joueur2", joueurCourantSuivant.Nom); }