コード例 #1
0
        public void ValidateThreeSame_18_2() //should return 18
        {
            Dice dice = new Dice();

            dice.AddDie(6);
            dice.AddDie(6);
            dice.AddDie(4);
            dice.AddDie(6);
            dice.AddDie(6);
            Assert.AreEqual(18, dice.ValidateThreeSame());
        }
コード例 #2
0
        public void ValidateFullHouse_20() //should return 20
        {
            Dice dice = new Dice();

            dice.AddDie(6);
            dice.AddDie(6);
            dice.AddDie(1);
            dice.AddDie(6);
            dice.AddDie(1);
            Assert.AreEqual(20, dice.ValidateFullHouse());
        }
コード例 #3
0
        public void ValidatePair_0() //should return 0 as no pair is found
        {
            Dice dice = new Dice();

            dice.AddDie(1);
            dice.AddDie(2);
            dice.AddDie(3);
            dice.AddDie(4);
            dice.AddDie(5);
            Assert.AreEqual(0, dice.ValidatePair());
        }
コード例 #4
0
        public void ValidateThreeSame_3() //should return 3
        {
            Dice dice = new Dice();

            dice.AddDie(1);
            dice.AddDie(1);
            dice.AddDie(4);
            dice.AddDie(3);
            dice.AddDie(1);
            Assert.AreEqual(3, dice.ValidateThreeSame());
        }
コード例 #5
0
        public void ValidateTwoPairs_0() //should return 0 as only one pair is found
        {
            Dice dice = new Dice();

            dice.AddDie(1);
            dice.AddDie(2);
            dice.AddDie(3);
            dice.AddDie(5);
            dice.AddDie(5);
            Assert.AreEqual(0, dice.ValidateTwoPairs());
        }
コード例 #6
0
        public void ValidateTwoPairs_8_3() //should return 8
        {
            Dice dice = new Dice();

            dice.AddDie(1);
            dice.AddDie(1);
            dice.AddDie(2);
            dice.AddDie(3);
            dice.AddDie(3);
            Assert.AreEqual(8, dice.ValidateTwoPairs());
        }
コード例 #7
0
        public void ValidateSmallStraight_15_2() //should return 15
        {
            Dice dice = new Dice();

            dice.AddDie(2);
            dice.AddDie(1);
            dice.AddDie(3);
            dice.AddDie(5);
            dice.AddDie(4);
            Assert.AreEqual(15, dice.ValidateSmallStraight());
        }
コード例 #8
0
        public void ValidateTwoPairs_6() //should return 0 as no pair was found
        {
            Dice dice = new Dice();

            dice.AddDie(1);
            dice.AddDie(1);
            dice.AddDie(1);
            dice.AddDie(2);
            dice.AddDie(2);
            Assert.AreEqual(6, dice.ValidateTwoPairs());
        }
コード例 #9
0
        public void ValidateYatzy_0_5() //should return 0 as all are not same
        {
            Dice dice = new Dice();

            dice.AddDie(6);
            dice.AddDie(6);
            dice.AddDie(6);
            dice.AddDie(6);
            dice.AddDie(1);
            Assert.AreEqual(0, dice.ValidateYatzy());
        }
コード例 #10
0
        public void ValidateSmallStraight_0() //should return 0
        {
            Dice dice = new Dice();

            dice.AddDie(1);
            dice.AddDie(2);
            dice.AddDie(3);
            dice.AddDie(4);
            dice.AddDie(6);
            Assert.AreEqual(0, dice.ValidateSmallStraight());
        }
コード例 #11
0
        public void ValidatePair_6() //should return 2 as biggest possible pair is 6.
        {
            Dice dice = new Dice();

            dice.AddDie(1);
            dice.AddDie(1);
            dice.AddDie(1);
            dice.AddDie(3);
            dice.AddDie(3);
            Assert.AreEqual(6, dice.ValidatePair());
        }
コード例 #12
0
        public void ValidateYatzy_50_6() //should return 50 as all are same
        {
            Dice dice = new Dice();

            dice.AddDie(6);
            dice.AddDie(6);
            dice.AddDie(6);
            dice.AddDie(6);
            dice.AddDie(6);
            Assert.AreEqual(50, dice.ValidateYatzy());
        }
コード例 #13
0
        public void ValidateTwoPairs_0_2() //should return 0
        {
            Dice dice = new Dice();

            dice.AddDie(1);
            dice.AddDie(1);
            dice.AddDie(4);
            dice.AddDie(3);
            dice.AddDie(1);
            Assert.AreEqual(0, dice.ValidateTwoPairs());
        }
コード例 #14
0
        public void ValidateFullHouse_5() //should return 5
        {
            Dice dice = new Dice();

            dice.AddDie(1);
            dice.AddDie(1);
            dice.AddDie(1);
            dice.AddDie(1);
            dice.AddDie(1);
            Assert.AreEqual(5, dice.ValidateFullHouse());
        }
コード例 #15
0
        public void ValidateBigStraight_20_2() //should return 15
        {
            Dice dice = new Dice();

            dice.AddDie(6);
            dice.AddDie(3);
            dice.AddDie(4);
            dice.AddDie(5);
            dice.AddDie(2);
            Assert.AreEqual(20, dice.ValidateBigStraight());
        }
コード例 #16
0
        public void ValidateFullHouse_0_3() //should return 0
        {
            Dice dice = new Dice();

            dice.AddDie(6);
            dice.AddDie(4);
            dice.AddDie(4);
            dice.AddDie(4);
            dice.AddDie(4);
            Assert.AreEqual(0, dice.ValidateFullHouse());
        }
コード例 #17
0
        public void ValidateFourSame_0() //should return 16
        {
            Dice dice = new Dice();

            dice.AddDie(4);
            dice.AddDie(4);
            dice.AddDie(4);
            dice.AddDie(1);
            dice.AddDie(6);
            Assert.AreEqual(0, dice.ValidateFourSame());
        }
コード例 #18
0
        public void ValidateSum() //should return 15
        {
            Dice dice = new Dice();

            dice.AddDie(1);
            dice.AddDie(2);
            dice.AddDie(3);
            dice.AddDie(4);
            dice.AddDie(5);
            Assert.AreEqual(15, dice.Sum());
        }
コード例 #19
0
        public void ValidateFourSame_24() //should return 24
        {
            Dice dice = new Dice();

            dice.AddDie(6);
            dice.AddDie(6);
            dice.AddDie(4);
            dice.AddDie(6);
            dice.AddDie(6);
            Assert.AreEqual(24, dice.ValidateFourSame());
        }
コード例 #20
0
        public void ValidateTwoPairs_10() //should return 10 (2*2 + 2*3)
        {
            Dice dice = new Dice();

            dice.AddDie(2);
            dice.AddDie(2);
            dice.AddDie(3);
            dice.AddDie(3);
            dice.AddDie(5);
            Assert.AreEqual(10, dice.ValidateTwoPairs());
        }
コード例 #21
0
        public void ValidateTwoPairs_8() //should return 8 cause 4*2
        {
            Dice dice = new Dice();

            dice.AddDie(2);
            dice.AddDie(2);
            dice.AddDie(2);
            dice.AddDie(2);
            dice.AddDie(5);
            Assert.AreEqual(8, dice.ValidateTwoPairs());
        }