|
|
|
@ -1,6 +1,4 @@
|
|
|
|
|
using CoreLibrary;
|
|
|
|
|
using CoreLibrary.Core;
|
|
|
|
|
using CoreLibrary.Evenements;
|
|
|
|
|
using CoreLibrary.Core;
|
|
|
|
|
using CoreLibrary.Joueurs;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using Xunit;
|
|
|
|
@ -69,5 +67,40 @@ namespace UnitTesting
|
|
|
|
|
Assert.IsType<bool>(estPossibleObj3);
|
|
|
|
|
Assert.False((bool)estPossibleObj3);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void TestSupprimerCodesImpossibles()
|
|
|
|
|
{
|
|
|
|
|
Code codeSecret = new Code(1);
|
|
|
|
|
codeSecret.AjouterJeton(new Jeton(Couleur.Rouge));
|
|
|
|
|
|
|
|
|
|
Code code1 = new Code(1);
|
|
|
|
|
code1.AjouterJeton(new Jeton(Couleur.Vert));
|
|
|
|
|
|
|
|
|
|
Code code2 = new Code(1);
|
|
|
|
|
code2.AjouterJeton(new Jeton(Couleur.Jaune));
|
|
|
|
|
|
|
|
|
|
List<Code> codes = new List<Code>([
|
|
|
|
|
codeSecret,
|
|
|
|
|
code1,
|
|
|
|
|
code2,
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
Plateau plateau = new Plateau(1, 1);
|
|
|
|
|
|
|
|
|
|
FieldInfo? codeSecretInfo = typeof(Plateau).GetField("codeSecret", BindingFlags.NonPublic | BindingFlags.Instance);
|
|
|
|
|
Assert.NotNull(codeSecretInfo);
|
|
|
|
|
codeSecretInfo.SetValue(plateau, codeSecret);
|
|
|
|
|
|
|
|
|
|
plateau.AjouterCode(codeSecret);
|
|
|
|
|
|
|
|
|
|
Assert.Equal(3, codes.Count);
|
|
|
|
|
|
|
|
|
|
MethodInfo? SupprimerCodesImpossiblesInfo = typeof(Robot).GetMethod("SupprimerCodesImpossibles", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static);
|
|
|
|
|
Assert.NotNull(SupprimerCodesImpossiblesInfo);
|
|
|
|
|
SupprimerCodesImpossiblesInfo.Invoke(new Robot(), [codes, plateau]);
|
|
|
|
|
|
|
|
|
|
Assert.Single(codes);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|