public void AddPlayerScoreTest() { const string playerName = "Pesho"; const int playerScore = 20; var scoreBoard = new ScoreBoard(); scoreBoard.AddPlayer(playerName, playerScore); Assert.AreEqual(true, scoreBoard.scoreBoard.ContainsKey(playerScore)); }
public void AddNegativePlayerScoreTest() { const string playerName = "Pesho"; const int playerScore = -1; var newScoreBoard = new ScoreBoard(); newScoreBoard.AddPlayer(playerName, playerScore); }
public void AddEmptyPlayerNameTest() { var output = new StringBuilder(); var textWriter = new StringWriter(output); Console.SetOut(textWriter); const string playerName = ""; const int playerScore = 20; const string expected = "unknown"; var newScoreBoard = new ScoreBoard(); newScoreBoard.AddPlayer(playerName, playerScore); Assert.IsTrue(newScoreBoard.ScoreBoardd.Contains(20, "unknown")); }
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); }