Esempio n. 1
0
        public void Given_I_have_a_list_of_frames_where_the_first_frame_is_a_spare_and_the_second_frame_first_bowl_is_9_I_will_get_back_a_list_of_frames_the_score_of_the_spare_is_19()
        {
            //given I have a list of frames
            FrameObject frame1 = new FrameObject();
            FrameObject frame2 = new FrameObject();

            //and the first frame total score is 10
            frame1.score = 10;
            //and the spare bool for the 1st frame is true
            frame1.wasSpare = true;
            //and the second frame first bowl score is 9
            frame2.bowl1 = 9;
            //and the strike bool for the 2nd frame is false
            frame2.wasStrike = false;
            //when the update frame score is calculated
            List <FrameObject> frameList = new List <FrameObject>()
            {
                frame1, frame2
            };
            ICalculateSpareScore calculateUpdatedFrame = new CalculateSpareScore();

            frameList = calculateUpdatedFrame.CalculateFrameScore(frameList);
            //then the first frame total score will be 19
            Assert.AreEqual(19, frame1.score);
        }
Esempio n. 2
0
        public void Given_I_have_a_list_of_frames_where_the_third_frame_is_a_spare_and_the_fourth_frame_first_bowl_is_10_I_will_get_back_a_list_of_frames_the_score_of_the_spare_is_20()
        {
            //given I have a list of frames
            FrameObject frame1 = new FrameObject();
            FrameObject frame2 = new FrameObject();
            FrameObject frame3 = new FrameObject();
            FrameObject frame4 = new FrameObject();

            //and the third frame total score is 10
            frame3.score = 10;
            //and the spare bool for the 3rd frame is true
            frame3.wasSpare = true;
            //and the fourth frame first bowl score is 10
            frame4.bowl1 = 10;
            //and the strike bool for the 3rd frame is false
            frame4.wasStrike = true;
            //when the update frame score is calculated
            List <FrameObject> frameList = new List <FrameObject>()
            {
                frame1, frame2, frame3, frame4
            };
            ICalculateSpareScore calculateUpdatedFrame = new CalculateSpareScore();

            frameList = calculateUpdatedFrame.CalculateFrameScore(frameList);
            //then the first frame total score will be 20
            Assert.AreEqual(20, frame3.score);
        }