Beispiel #1
0
        public void ReturnsScore()
        {
            var section = new UpperSection(x => 1, x => 2, x => 3, x => 4, x => 5, x => 6);

            section.Preview(new List <int>());
            section.Lock(ScoreCard.Items.Sixes);
            section.Preview(new List <int>());
            section.Lock(ScoreCard.Items.Fours);
            section.Preview(new List <int>());

            Assert.Equal(10, section.Score);
        }
Beispiel #2
0
        public void CannotLockInScoreThatIsNotPartOfTheUpperSection()
        {
            var section = new UpperSection(x => 1, x => 2, x => 3, x => 4, x => 5, x => 6);

            section.Preview(new List <int>());

            Assert.Throws <Exception>(() => section.Lock(ScoreCard.Items.ThreeOfAKind));
        }
Beispiel #3
0
        public void ReturnsBonusWhenUpperSectionSumIsEqualToSixtyThree()
        {
            var section = new UpperSection(x => 63, x => 2, x => 3, x => 4, x => 5, x => 6);

            section.Preview(new List <int>());
            section.Lock(ScoreCard.Items.Ones);

            Assert.Equal(35, section.Bonus);
        }
Beispiel #4
0
        public void ReturnsScoreIncludingBonus()
        {
            var section = new UpperSection(x => 1, x => 2, x => 3, x => 4, x => 5, x => 63);

            section.Preview(new List <int>());
            section.Lock(ScoreCard.Items.Sixes);
            section.Preview(new List <int>());

            Assert.Equal(63 + 35, section.Score);
        }
Beispiel #5
0
        public void LockInFivesScore()
        {
            var section = new UpperSection(x => 1, x => 2, x => 3, x => 4, x => 5, x => 6);

            section.Preview(new List <int>());
            section.Lock(ScoreCard.Items.Fives);

            Assert.Equal(0, section.Ones);
            Assert.Equal(0, section.Twos);
            Assert.Equal(0, section.Threes);
            Assert.Equal(0, section.Fours);
            Assert.Equal(5, section.Fives);
            Assert.Equal(0, section.Sixes);
        }