public void ExpectScoreboardAddMethodToThrowsWhenNonePositiveIntegerForMovesIsProvided() { var scoreboard = new Scoreboard(); var moves = -1; var playerName = "Test Player"; scoreboard.Add(moves, playerName); }
public void ExpectScoreboardAddMethodToAddScoreToTopsScores() { var moves = 5; var playerName = "Test Player"; var scoreboard = new Scoreboard(); scoreboard.Add(moves, playerName); var topScore = scoreboard.GetTopScores()[0]; Assert.IsInstanceOfType(topScore, typeof(Score)); }
public void ExpectScoreboardAddMethodNotToAddScoreToTopsScoresWhenIsNotInTopScores() { var scoreboard = new Scoreboard(); var playerName = "Test Player"; var maxCountTopScores = Constants.ScoreboardMaxCount; for (int moves = 1; moves <= maxCountTopScores; moves++) { scoreboard.Add(moves, playerName); } scoreboard.Add(maxCountTopScores + 1, playerName); var actualCountOfScoresOutOfTop = scoreboard.GetTopScores() .Where(s => s.Moves == maxCountTopScores + 1) .Count(); var expectedCountOfScoresOutOfTop = 0; Assert.AreEqual(expectedCountOfScoresOutOfTop, actualCountOfScoresOutOfTop); }
public void ExpectScoreboardAddMethodToThrowsWhenNullIsProvidedForPlayerNameAndNonPositiveIntegerForMoves() { var scoreboard = new Scoreboard(); var moves = -5; string playerName = null; scoreboard.Add(moves, playerName); }
public void ExpectScoreboardToStringReturnsCorrectScoreboardString() { var scoreboard = new Scoreboard(); var moves = 5; var playerName = "Test Player"; scoreboard.Add(moves, playerName); var actualToString = scoreboard.ToString(); var expectedToString = Constants.Scoreboard + Environment.NewLine + string.Format(Constants.ScoreboardFormat, 1, playerName, moves) + Environment.NewLine; Assert.AreEqual(expectedToString, actualToString); }
public void ExpectScoreboardIsInTopScoresMethodToToreturnTrueWhenTopScorProvided() { var scoreboard = new Scoreboard(); var playerName = "Test Player"; var maxCountTopScores = Constants.ScoreboardMaxCount; for (int moves = 1; moves <= maxCountTopScores; moves++) { scoreboard.Add(moves, playerName); } var expecterIsInTopScore = scoreboard.IsInTopScores(maxCountTopScores - 1); Assert.IsTrue(expecterIsInTopScore); }
public void ExpectScoreboardAddMethodToThrowsWhenNullIsProvidedForPlayerNameParameter() { var scoreboard = new Scoreboard(); var moves = 5; string playerName = null; scoreboard.Add(moves, playerName); }