Beispiel #1
0
        public void Frame2RollsKnockDown10PinsIsStrikeOk()
        {
            Frame frame = new Frame();
            frame.Roll(10);

            Assert.AreEqual(true, frame.IsStrike);
        }
Beispiel #2
0
        public void Frame2RollsKnockDown4Plus3PinsScore7()
        {
            Frame frame = new Frame();
            frame.Roll(4);
            frame.Roll(3);

            Assert.AreEqual(7, frame.Score);
        }
Beispiel #3
0
        public void Frame2RollsKnockDown4Plus3PinsIsStrikeNok()
        {
            Frame frame = new Frame();
            frame.Roll(4);
            frame.Roll(3);

            Assert.AreEqual(false, frame.IsStrike);
        }
Beispiel #4
0
        public void Frame2RollsKnockDown4Plus3PinsFinishOK()
        {
            Frame frame = new Frame();
            frame.Roll(4);
            frame.Roll(3);

            Assert.AreEqual(true, frame.IsFinish);
        }
Beispiel #5
0
        public void Frame2RollsKnockDown0Plus10PinsSpareOK()
        {
            Frame frame = new Frame();
            frame.Roll(0);
            frame.Roll(10);

            Assert.AreEqual(true, frame.IsSpare);
        }
Beispiel #6
0
        public void Frame2RollsKnockDown0Plus10PinsFinishOk()
        {
            Frame frame = new Frame();
            frame.Roll(0);
            frame.Roll(10);

            Assert.AreEqual(true, frame.IsFinish);
        }
Beispiel #7
0
        public void Frame2RollsKnockDown0Plus10PinsSCore0()
        {
            Frame frame = new Frame();
            frame.Roll(0);
            frame.Roll(10);

            Assert.AreEqual(0, frame.Score);
        }
Beispiel #8
0
        public void Roll(int nbPins)
        {
            if (currentFrame == null)
                currentFrame = new Frame();

            currentFrame.Roll(nbPins);

            if (listFrame.Count > 0 && (listFrame[listFrame.Count - 1].IsSpare || listFrame[listFrame.Count - 1].IsStrike))
                listFrame[listFrame.Count - 1].AddBonus(nbPins);

            if (listFrame.Count > 1 && listFrame[listFrame.Count - 2].IsStrike)
                listFrame[listFrame.Count - 2].AddBonus(nbPins);

            if (currentFrame.IsFinish)
            {
                listFrame.Add(currentFrame);
                currentFrame = null;
            }
        }
Beispiel #9
0
        public void FrameOneRollKnockDown4PinsSpareNOK()
        {
            Frame frame = new Frame();
            frame.Roll(4);

            Assert.AreEqual(false, frame.IsSpare);
        }
Beispiel #10
0
        public void FrameOneRollKnockDown4PinsScore0()
        {
            Frame frame = new Frame();
            frame.Roll(4);

            Assert.AreEqual(0, frame.Score);
        }
Beispiel #11
0
        public void FrameOneRollKnockDown4PinsFinishNok()
        {
            Frame frame = new Frame();
            frame.Roll(4);

            Assert.AreEqual(false, frame.IsFinish);
        }
Beispiel #12
0
        public void Frame2RollsKnockDown4Plus6PinsSpareOK()
        {
            Frame frame = new Frame();
            frame.Roll(4);
            frame.Roll(6);

            Assert.AreEqual(true, frame.IsSpare);
        }
Beispiel #13
0
        public void Frame2RollsKnockDown4Plus6PinsScore0()
        {
            Frame frame = new Frame();
            frame.Roll(4);
            frame.Roll(6);

            Assert.AreEqual(0, frame.Score);
        }