예제 #1
0
        public void testRulesNoRules()
        {
            ScoreSheet scoreSheet = new ScoreSheet();
            scoreSheet.setupGame("Yacht");
            List<String> rules = scoreSheet.getRules();

            foreach (string str in rules)
            {
                Assert.AreNotEqual("If you score at least 63 points in the upper categories, you gain a bonus 35 points.", str);
                Assert.AreNotEqual("For each additional Yahtzee you roll with a non-zero score in the Yahtzee category, you gain an additional 100 points.", str);
                Assert.AreNotEqual("If you roll a Yahtzee but the Yahztzee category is already scored, then Joker Rules go into effect.  If you can get a nonzero score in an upper category, you must score there.  Otherwise, you must score in a lower category.  The normal scoring restrictions do not apply.  If all lower categories are filled, you must take a 0 in an upper category.", str);
            }
        }
예제 #2
0
        public void testRulesStandard()
        {
            ScoreSheet scoreSheet = new ScoreSheet();
            scoreSheet.setupGame("Yahtzee");
            List<String> rules = scoreSheet.getRules();

            Assert.AreEqual("Welcome to Yahtzee!  Here are the scoring rules for you game.", rules[0]);
            Assert.AreEqual("", rules[1]);
            Assert.AreEqual("How to each category scores:", rules[2]);
            Assert.AreEqual("Aces: Scores the sum of all dice showing 1.", rules[3]);
            Assert.AreEqual("Twos: Scores the sum of all dice showing 2.", rules[4]);
            Assert.AreEqual("Threes: Scores the sum of all dice showing 3.", rules[5]);
            Assert.AreEqual("Fours: Scores the sum of all dice showing 4.", rules[6]);
            Assert.AreEqual("Fives: Scores the sum of all dice showing 5.", rules[7]);
            Assert.AreEqual("Sixes: Scores the sum of all dice showing 6.", rules[8]);
            Assert.AreEqual("Three of a Kind: If there are three matching dice, score the total of all dice.  Otherwise, score 0.", rules[9]);
            Assert.AreEqual("Four of a Kind: If there are four matching dice, score the total of all dice.  Otherwise, score 0.", rules[10]);
            Assert.AreEqual("Full House: If there are three of one value and two of a different value, score 25.  Otherwise, score 0.", rules[11]);
            Assert.AreEqual("Small Straight: If the dice show four consecutive values, score 30.  Otherwise, score 0.", rules[12]);
            Assert.AreEqual("Large Straight: If the dice show five consecutive numbers, score 40.  Otherwise, score 0.", rules[13]);
            Assert.AreEqual("Yahtzee: If all dice show the same value, score 50.  Otherwise, score 0.", rules[14]);
            Assert.AreEqual("Chance: Score total of all dice.", rules[15]);
            Assert.AreEqual("", rules[16]);
            Assert.AreEqual("If you score at least 63 points in the upper categories, you gain a bonus 35 points.", rules[17]);
            Assert.AreEqual("", rules[18]);
            Assert.AreEqual("For each additional Yahtzee you roll with a non-zero score in the Yahtzee category, you gain an additional 100 points.", rules[19]);
            Assert.AreEqual("", rules[20]);
            Assert.AreEqual("If you roll a Yahtzee but the Yahztzee category is already scored, then Joker Rules go into effect.  If you can get a nonzero score in an upper category, you must score there.  Otherwise, you must score in a lower category.  The normal scoring restrictions do not apply.  If all lower categories are filled, you must take a 0 in an upper category.", rules[21]);
        }
예제 #3
0
        public void testRulesBonus()
        {
            ScoreSheet scoreSheet = new ScoreSheet();
            scoreSheet.setupGame("Yatzy");
            List<String> rules = scoreSheet.getRules();

            Assert.AreEqual("If you score at least 63 points in the upper categories, you gain a bonus 50 points.", rules[19]);
        }