public void TestExecuteCommandTop() { BullsAndCowsGame_Accessor game = SetSecretNumberDigits(1, 2, 3, 4); StringBuilder sb = new StringBuilder(); StringWriter writer = new StringWriter(sb); Console.SetOut(writer); Scoreboard scoreboard = new Scoreboard(); scoreboard.AddNewResult(new PlayerInfo("Tisho", 1)); game.ExecuteCommand(scoreboard, "top"); writer.Close(); string expected = "Scoreboard:" + Environment.NewLine + "1. Tisho --> 1 guess" + Environment.NewLine; string actual = sb.ToString(); Assert.AreEqual <string>(expected, actual, EXECUTING_COMMAND_ERROR_MSG); }