public void PrintEmtyScoreBoardTest() { var output = new StringBuilder(); var textWriter = new StringWriter(output); Console.SetOut(textWriter); var newScoreboard = new ScoreBoard(); newScoreboard.PrintScoreBoard(); string outputStr = output.ToString(); Assert.AreEqual("\r\nScoreboard is empty!\r\n\r\n", outputStr); }
public void PrintFivePlayersInScoreBoardTest() { var output = new StringBuilder(); var textWriter = new StringWriter(output); Console.SetOut(textWriter); var newScoreboard = new ScoreBoard(); newScoreboard.AddPlayer("Pesho", 29); newScoreboard.AddPlayer("Angel", 5); newScoreboard.AddPlayer("John", 35); newScoreboard.AddPlayer("Mike", 4); newScoreboard.AddPlayer("Ben", 3); newScoreboard.PrintScoreBoard(); string outputStr = output.ToString(); Assert.AreEqual("Scoreboard:\r\n1. John --> 35 cells\r\n2. Pesho --> 29 cells\r\n3. Angel --> 5 cells\r\n4. Mike --> 4 cells\r\n5. Ben --> 3 cells\r\n\r\n", outputStr); }
public void PrintOnePlayerInScoreBoardTest() { var output = new StringBuilder(); var textWriter = new StringWriter(output); Console.SetOut(textWriter); var newScoreboard = new ScoreBoard(); newScoreboard.AddPlayer("Pesho", 29); newScoreboard.PrintScoreBoard(); string outputStr = output.ToString(); Assert.AreEqual("Scoreboard:\r\n1. Pesho --> 29 cells\r\n\r\n", outputStr); }