Beispiel #1
0
        public void GameAnalyzor_NextTwoCountDouble_WhenFrmaeIsStrike()
        {
            //Arrange
            _gameAnalyzor = new GameAnalyzor(_emptyFrames);

            //Act
            (bool isGameOver, bool doesTwoNextCountDouble, bool doesNextCountDouble) = _gameAnalyzor.UpdateGame(10);

            //Assert
            Assert.False(isGameOver);
            Assert.True(doesTwoNextCountDouble);
            Assert.False(doesNextCountDouble);
        }
Beispiel #2
0
        public void GameAnalyzor_ReturnNextCountDouble_WhenFrameIsSpare()
        {
            //Arrange
            _gameAnalyzor = new GameAnalyzor(_emptyFrames);

            //Act
            _gameAnalyzor.UpdateGame(2);
            (bool isGameOver, bool doesTwoNextCountDouble, bool doesNextCountDouble) = _gameAnalyzor.UpdateGame(8);

            //Assert
            Assert.False(isGameOver);
            Assert.False(doesTwoNextCountDouble);
            Assert.True(doesNextCountDouble);
        }
Beispiel #3
0
        public void ValidateGame_GameIsOver_WhenLastIsClassic()
        {
            //Arrange
            Frame[] frames = new Frame[10];
            for (int i = 0; i < 9; i++)
            {
                frames[i] = GetValidDoneFrame();
            }
            frames[9] = new Frame {
                IsLastOne = true, FirstAttemp = 3
            };
            _gameAnalyzor = new GameAnalyzor(frames);

            //Act
            (bool isGameOver, bool doesTwoNextCountDouble, bool doesNextCountDouble) = _gameAnalyzor.UpdateGame(5);

            //Assert
            Assert.True(isGameOver);
            Assert.False(doesTwoNextCountDouble);
            Assert.False(doesNextCountDouble);
        }
Beispiel #4
0
        public void ValidateGame_WhenLastFrameIsStrike_GameIsNotOver()
        {
            //Arrange
            Frame[] frames = new Frame[10];
            for (int i = 0; i < 9; i++)
            {
                frames[i] = GetValidDoneFrame();
            }
            frames[9] = new Frame {
                IsLastOne = true
            };
            _gameAnalyzor = new GameAnalyzor(frames);

            //Act
            (bool isGameOver, bool doesTwoNextCountDouble, bool doesNextCountDouble) = _gameAnalyzor.UpdateGame(10);

            //Assert
            Assert.False(isGameOver);
            Assert.False(doesTwoNextCountDouble);
            Assert.False(doesNextCountDouble);
        }