|
|
@ -4,6 +4,7 @@ using CoreLibrary.Events;
|
|
|
|
using Microsoft.VisualStudio.TestPlatform.Utilities;
|
|
|
|
using Microsoft.VisualStudio.TestPlatform.Utilities;
|
|
|
|
using System;
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
using System.Diagnostics.Tracing;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
using System.Text;
|
|
|
|
using System.Text;
|
|
|
@ -24,7 +25,8 @@ namespace UnitTesting
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Console.SetOut(sw);
|
|
|
|
Console.SetOut(sw);
|
|
|
|
|
|
|
|
|
|
|
|
Evenements.CommencerLaPartie(null, null);
|
|
|
|
|
|
|
|
|
|
|
|
Evenements.CommencerLaPartie(null, new DebutPartieEventArgs());
|
|
|
|
|
|
|
|
|
|
|
|
string consoleOutput = sw.ToString().Trim();
|
|
|
|
string consoleOutput = sw.ToString().Trim();
|
|
|
|
|
|
|
|
|
|
|
@ -51,10 +53,8 @@ namespace UnitTesting
|
|
|
|
|
|
|
|
|
|
|
|
Couleur couleurJeton = Couleur.BLEU;
|
|
|
|
Couleur couleurJeton = Couleur.BLEU;
|
|
|
|
Jeton jeton = new Jeton(couleurJeton);
|
|
|
|
Jeton jeton = new Jeton(couleurJeton);
|
|
|
|
AjouterJetonEventArgs eventArgs = new AjouterJetonEventArgs(jeton);
|
|
|
|
|
|
|
|
|
|
|
|
Evenements.AjouterJeton(null, new AjouterJetonEventArgs(jeton));
|
|
|
|
|
|
|
|
|
|
|
|
Evenements.AjouterJeton(null, eventArgs);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string consoleOutput = sw.ToString().Trim();
|
|
|
|
string consoleOutput = sw.ToString().Trim();
|
|
|
@ -74,7 +74,7 @@ namespace UnitTesting
|
|
|
|
Console.SetOut(sw);
|
|
|
|
Console.SetOut(sw);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Evenements.SupprimerDernierJeton(null, null);
|
|
|
|
Evenements.SupprimerDernierJeton(null, new SupprimerDernierJetonEventArgs());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string consoleOutput = sw.ToString().Trim();
|
|
|
|
string consoleOutput = sw.ToString().Trim();
|
|
|
@ -92,8 +92,9 @@ namespace UnitTesting
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Console.SetOut(sw);
|
|
|
|
Console.SetOut(sw);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code code = new Code(4);
|
|
|
|
|
|
|
|
|
|
|
|
Evenements.AjouterCode(null, null);
|
|
|
|
Evenements.AjouterCode(null, new AjouterCodeEventArgs(code));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string consoleOutput = sw.ToString().Trim();
|
|
|
|
string consoleOutput = sw.ToString().Trim();
|
|
|
@ -103,6 +104,12 @@ namespace UnitTesting
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static class Constants
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
public static readonly Joueur[] EmptyJoueurArray = Array.Empty<Joueur>();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
[Fact]
|
|
|
|
public void TestPartieTerminee()
|
|
|
|
public void TestPartieTerminee()
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -112,10 +119,10 @@ namespace UnitTesting
|
|
|
|
Console.SetOut(sw);
|
|
|
|
Console.SetOut(sw);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Evenements.PartieTerminee(null, new PartieTermineeEventArgs(new Joueur[] { }, new Joueur[] { }));
|
|
|
|
Evenements.PartieTerminee(null, new PartieTermineeEventArgs(Constants.EmptyJoueurArray, Constants.EmptyJoueurArray));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Evenements.PartieTerminee(null, new PartieTermineeEventArgs(new Joueur[] { new Joueur("Camille", new Plateau(4, 12)) }, new Joueur[] { }));
|
|
|
|
Evenements.PartieTerminee(null, new PartieTermineeEventArgs(new Joueur[] { new Joueur("Camille", new Plateau(4, 12)) }, Constants.EmptyJoueurArray));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Evenements.PartieTerminee(null, new PartieTermineeEventArgs(new Joueur[] { new Joueur("Pauline", new Plateau(4, 12)), new Joueur("Celeste", new Plateau(4, 12)) }, new Joueur[] { }));
|
|
|
|
Evenements.PartieTerminee(null, new PartieTermineeEventArgs(new Joueur[] { new Joueur("Pauline", new Plateau(4, 12)), new Joueur("Celeste", new Plateau(4, 12)) }, new Joueur[] { }));
|
|
|
|