public void GameScorerTest() { // Arrange var rollNumbers = new int[] { 4, 5, 2, 3, 5 }; // Act var scoreCard = GameScorer.Score(rollNumbers); // Assert Assert.AreEqual(0, scoreCard.Ones); Assert.AreEqual(2, scoreCard.Twos); Assert.AreEqual(3, scoreCard.Threes); Assert.AreEqual(4, scoreCard.Fours); Assert.AreEqual(10, scoreCard.Fives); Assert.AreEqual(0, scoreCard.Sixes); Assert.AreEqual(0, scoreCard.ThreeOfAKind); Assert.AreEqual(0, scoreCard.FourOfAKind); Assert.AreEqual(0, scoreCard.FullHouse); Assert.AreEqual(30, scoreCard.SmallStraight); Assert.AreEqual(0, scoreCard.LargeStraight); Assert.AreEqual(0, scoreCard.Yahtzee); Assert.AreEqual(19, scoreCard.Chance); // I realize this isn't a "unit" test per se, but it effectively // tests the scoring algorithm as a whole }
public void GameScorer_ContainsTooLargeRollNumber() { // Arrange var rollNumbers = new int[] { 4, 5, 2, 7, 5 }; // Act GameScorer.Score(rollNumbers); // Assert }
public void GameScorer_ContainsTooSmallRollNumber() { // Arrange var rollNumbers = new int[] { 4, 5, 2, 3, 0 }; // Act GameScorer.Score(rollNumbers); // Assert }
public void GameScorer_TooManyRollNumbers() { // Arrange var rollNumbers = new int[] { 4, 5, 2, 3, 5, 1 }; // Act GameScorer.Score(rollNumbers); // Assert }
public void testBasicFrameScores(int roll1, int roll2, int expected) { List <frame> frameList = new List <frame>() { new frame(roll1, roll2) }; GameScorer scorer = new GameScorer(frameList); Assert.Equal(expected, scorer.scoreFrame(0)); }
public void testStrikeSpare() { List <frame> frameList = new List <frame>() { new frame(10, 0), new frame(0, 10), new frame(10, 0), new frame(10, 0) }; GameScorer scorer = new GameScorer(frameList); Assert.Equal(20, scorer.scoreFrame(0)); Assert.Equal(20, scorer.scoreFrame(1)); }
public void testStrike() { List <frame> frameList = new List <frame>() { new frame(10, 0), new frame(10, 0), new frame(10, 0), new frame(1, 1) }; GameScorer scorer = new GameScorer(frameList); Assert.Equal(30, scorer.scoreFrame(0)); Assert.Equal(12, scorer.scoreFrame(2)); }
public void testSplit() { List <frame> frameList = new List <frame>() { new frame(0, 10), new frame(2, 2), new frame(3, 7), new frame(6, 4) }; GameScorer scorer = new GameScorer(frameList); Assert.Equal(12, scorer.scoreFrame(0)); Assert.Equal(16, scorer.scoreFrame(2)); }
public void testPerfectGame() { List <frame> frameList = new List <frame>() { new frame(10, 0), new frame(10, 0), new frame(10, 0), new frame(10, 0), new frame(10, 0), new frame(10, 0), new frame(10, 0), new frame(10, 0), new frame(10, 0), new frame(10, 10), new frame(10, 0), }; GameScorer scorer = new GameScorer(frameList); Assert.Equal(300, scorer.scoreGame()); }
public void testBeginnerGame() { List <frame> frameList = new List <frame>() { new frame(10, 0), new frame(1, 0), new frame(7, 2), new frame(10, 0), new frame(9, 1), new frame(4, 6), new frame(10, 0), new frame(10, 0), new frame(1, 7), new frame(7, 1), new frame(0, 0) }; GameScorer scorer = new GameScorer(frameList); Assert.Equal(130, scorer.scoreGame()); }
public void testAlsoAlmostPerfectGame() { List <frame> frameList = new List <frame>() { new frame(10, 0), new frame(10, 0), new frame(10, 0), new frame(10, 0), new frame(10, 0), new frame(10, 0), new frame(10, 0), new frame(10, 0), new frame(10, 0), new frame(10, 1), new frame(9, 0) }; GameScorer scorer = new GameScorer(frameList); Assert.Equal(281, scorer.scoreGame()); }
public void SetUp() { _player1 = new Player("Player 1"); _player2 = new Player("Player 2"); _gameScorer = new GameScorer(_player1, _player2); }
public void GameScorer_RollNumbersIsNull() { GameScorer.Score(null); }
public void SetUp() { _gameScorer = new GameScorer(new Player("Player 1"), new Player("Player 2")); _scoreBuilder = new ScoreBuilder(_gameScorer); }