You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
2.0 KiB
61 lines
2.0 KiB
using ConsoleApp;
|
|
using CoreLibrary;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.IO;
|
|
using System.Threading.Tasks;
|
|
using Xunit;
|
|
using System.Reflection;
|
|
|
|
namespace UnitTesting
|
|
{
|
|
public class UtilsUT
|
|
{
|
|
[Fact]
|
|
public void TestCouleursTerminal()
|
|
{
|
|
Dictionary < Couleur, ConsoleColor> expectedCouleursTerminal = new Dictionary<Couleur, ConsoleColor>()
|
|
{
|
|
{Couleur.NOIR, ConsoleColor.Black },
|
|
{Couleur.BLANC, ConsoleColor.White },
|
|
{Couleur.ROUGE, ConsoleColor.Red },
|
|
{Couleur.VERT, ConsoleColor.Green },
|
|
{Couleur.BLEU, ConsoleColor.Blue },
|
|
{Couleur.JAUNE, ConsoleColor.DarkYellow }
|
|
};
|
|
|
|
var actualCouleursTerminal = typeof(Utils).GetField("couleursTerminal", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static)!.GetValue(null);
|
|
|
|
Assert.Equal(expectedCouleursTerminal, actualCouleursTerminal);
|
|
}
|
|
|
|
[Fact]
|
|
public void TestIndicateursTerminal()
|
|
{
|
|
Dictionary<Indicateur, ConsoleColor> expectedIndicateursTerminal = new Dictionary<Indicateur, ConsoleColor>()
|
|
{
|
|
{Indicateur.BONNEPLACE, ConsoleColor.Black },
|
|
{Indicateur.BONNECOULEUR, ConsoleColor.White }
|
|
};
|
|
|
|
var actualIndicateursTerminal = typeof(Utils).GetField("indicateursTerminal", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static)!.GetValue(null);
|
|
|
|
Assert.Equal(expectedIndicateursTerminal, actualIndicateursTerminal);
|
|
}
|
|
|
|
[Fact]
|
|
public void TestDessinerPionValide()
|
|
{
|
|
using (StringWriter sw = new StringWriter())
|
|
{
|
|
Console.SetOut(sw);
|
|
Utils.DessinerPion(Couleur.NOIR);
|
|
string expected = " ⬤ ";
|
|
Assert.Equal(expected, sw.ToString());
|
|
}
|
|
}
|
|
}
|
|
}
|