Ejemplo n.º 1
0
        public void ScoreSpareFrame_Confirms_Frame_To_Score_Is_Spare()
        {
            const int subsequentFrameBall1Pins = 1;

            _frameToScore.Expect(f => f.IsSpare()).Return(true);
            _frameToScore.Expect(f => f.NextFrame).Return(_subsequentFrame1);
            _subsequentFrame1.Expect(f => f.PinsWithBall1).Return(subsequentFrameBall1Pins);

            _testObject.ScoreFrame(_frameToScore);
        }
Ejemplo n.º 2
0
        public void ScoreStrikeFrame_Returns_Correct_Frame_Total_When_Subsequent_Frame_Is_A_Spare_Frame()
        {
            const int subsequentFrame1Ball1Pins = 0;
            const int subsequentFrame1Ball2Pins = TotalPins;
            const int subsequentFrame2Ball1Pins = 2;
            const int expectedFrameScore        = TotalPins + subsequentFrame1Ball1Pins + subsequentFrame1Ball2Pins;

            _frameToScore.Expect(f => f.IsStrike()).Return(true);
            _frameToScore.Expect(f => f.NextFrame).Return(_subsequentFrame1);

            _subsequentFrame1.Expect(s => s.NextFrame).Return(_subsequentFrame2);
            _subsequentFrame1.Expect(f => f.PinsWithBall1).Return(subsequentFrame1Ball1Pins);
            _subsequentFrame1.Expect(f => f.PinsWithBall2).Return(subsequentFrame1Ball2Pins);

            _subsequentFrame2.Expect(f => f.PinsWithBall1).Return(subsequentFrame2Ball1Pins);

            var actualFrameScore = _testObject.ScoreFrame(_frameToScore);

            Assert.That(actualFrameScore, Is.EqualTo(expectedFrameScore));
        }
Ejemplo n.º 3
0
        public void ScoreNormalFrame_Returns_Correct_Frame_Total()
        {
            const int ball1Pins          = 1;
            const int ball2Pins          = 2;
            const int expectedFrameScore = ball1Pins + ball2Pins;

            _frameToScore.Expect(f => f.PinsWithBall1).Return(ball1Pins);
            _frameToScore.Expect(f => f.PinsWithBall2).Return(ball2Pins);

            var actualFrameScore = _testObject.ScoreFrame(_frameToScore);

            Assert.That(actualFrameScore, Is.EqualTo(expectedFrameScore));
        }