|
|
@ -56,5 +56,37 @@ namespace UnitTesting
|
|
|
|
Assert.Equal(expected, sw.ToString());
|
|
|
|
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());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|