|
|
@ -1,6 +1,7 @@
|
|
|
|
using CoreLibrary.Core;
|
|
|
|
using CoreLibrary.Core;
|
|
|
|
using CoreLibrary.Events;
|
|
|
|
using CoreLibrary.Events;
|
|
|
|
using CoreLibrary.Joueurs;
|
|
|
|
using CoreLibrary.Joueurs;
|
|
|
|
|
|
|
|
using System.Reflection;
|
|
|
|
using Xunit;
|
|
|
|
using Xunit;
|
|
|
|
|
|
|
|
|
|
|
|
namespace UnitTesting
|
|
|
|
namespace UnitTesting
|
|
|
@ -55,5 +56,28 @@ namespace UnitTesting
|
|
|
|
Assert.NotNull(codeEvenement);
|
|
|
|
Assert.NotNull(codeEvenement);
|
|
|
|
Assert.Equal(code, codeEvenement);
|
|
|
|
Assert.Equal(code, codeEvenement);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
|
|
|
public void JoueurQuandJouerCode()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Code code = new Code(4);
|
|
|
|
|
|
|
|
code.AjouterJeton(new Jeton(Couleur.ROUGE));
|
|
|
|
|
|
|
|
code.AjouterJeton(new Jeton(Couleur.BLANC));
|
|
|
|
|
|
|
|
code.AjouterJeton(new Jeton(Couleur.BLEU));
|
|
|
|
|
|
|
|
code.AjouterJeton(new Jeton(Couleur.NOIR));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code? codeEvenement = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Joueur joueur = new Joueur("Céleste");
|
|
|
|
|
|
|
|
joueur.JouerCode += (Object? sender, JouerCodeEventArgs e) => codeEvenement = e.Code;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Type type = typeof(Joueur);
|
|
|
|
|
|
|
|
MethodInfo? methodInfo = type.GetMethod("QuandJouerCode", BindingFlags.NonPublic | BindingFlags.Instance);
|
|
|
|
|
|
|
|
Assert.NotNull(methodInfo);
|
|
|
|
|
|
|
|
methodInfo.Invoke(joueur, [code]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Assert.NotNull(codeEvenement);
|
|
|
|
|
|
|
|
Assert.Equal(code, codeEvenement);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|