예제 #1
0
 public void D100ReturnsAllSideValues()
 {
     ValidateAllSides(Die.D100());
     Assert.Pass();
 }
예제 #2
0
파일: DieTest.cs 프로젝트: dordwin/Dice
        public void TestDieSetRollDiceIndividually()
        {
            // create dice and set
            Die d1 = new Die();
            Die d2 = new Die();
            Die d3 = new Die();
            DiceSet set = new DiceSet();
            set.Add(d1);
            set.Add(d2);
            set.Add(d3);

            // roll dice individually
            d1.Roll();
            d2.Roll();
            d3.Roll();

            // add rolls of dice
            int total = d1.RollResult + d2.RollResult + d3.RollResult;

            // test that the set roll matches the individual dice
            Assert.AreEqual<int>(total, set.RollResult, "Dieset roll does not match total value of individually rolled dice.");
        }
예제 #3
0
        public void CreateAnArrayOfDiceByPassingANumberIntoTheHelperMethod()
        {
            var diceArray = Die.GetDice(DiceSides.d12, 4);

            Assert.AreEqual(new Die[] { Die.D12(), Die.D12(), Die.D12(), Die.D12() }, diceArray);
        }
예제 #4
0
 public static void RollDice(Die instance, int sideCount)
 {
     int newValue = Roll(sideCount);
     
     instance.DotCount = newValue;
 }
예제 #5
0
        public void AddNewDie(int sides)
        {
            Die d = new Die(sides);

            this.Dice.Add(d);
        }
예제 #6
0
        public void CupCanBeCreatedWithArrayOfDice()
        {
            var cup = new Cup(Die.GetDice(DiceSides.d6, 4));

            Assert.AreEqual(new Die[] { Die.D6(), Die.D6(), Die.D6(), Die.D6() }, cup.Dice);
        }
예제 #7
0
 /// <summary>
 /// Adds a new instance of the Die class to the instance of the Dice class.
 /// </summary>
 /// <param name="die">A new Die instance.</param>
 public void AddDieToArray(Die die)
 {
     diceList.Add(die);
 }