Test class UtilsUT du titre
continuous-integration/drone/push Build is passing Details

master
parent 6301e32cbc
commit ed9047a35f

@ -16,6 +16,9 @@ namespace UnitTesting
{
public class EvenementsUT
{
[Fact]
public void TestCommencerLaPartie()
{

@ -56,5 +56,37 @@ namespace UnitTesting
Assert.Equal(expected, sw.ToString());
}
}
[Fact]
public void TestDessinerTitre()
{
// Capture de la sortie console
using (StringWriter sw = new StringWriter())
{
Console.SetOut(sw);
// Appel de la fonction à tester
Utils.DessinerTitre();
// Récupération de la sortie console dans une chaîne
string consoleOutput = sw.ToString();
// Chaîne attendue pour le titre
string titreAttendu = @"
__ __ _ _ _
| \/ | __ _ ___| |_ ___ _ _ _ __ (_) _ _ __| |
| |\/| |/ _` |(_-<| _|/ -_)| '_|| ' \ | || ' \ / _` |
|_| |_|\__,_|/__/ \__|\___||_| |_|_|_||_||_||_|\__,_|
";
consoleOutput = consoleOutput.Replace("\n", "").Replace("\r", "");
titreAttendu = titreAttendu.Replace("\n", "").Replace("\r", "");
// Assertion pour vérifier si la sortie console correspond au titre attendu
Assert.Equal(titreAttendu.Trim(), consoleOutput.Trim());
}
}
}
}

Loading…
Cancel
Save