Exemplo n.º 1
0
        public void CreateDiceShouldReturnADiceObject()
        {
            var expected = new Dice(new Random());
            var actual   = sut.CreateDice();

            Assert.AreEqual(expected.GetType(), actual.GetType());
        }
        public void RoleDiceForeNumTest()
        {
            IDice dice = DiceFactory.CreateDice(4);
            int   num  = dice.RoleDiceForeNum();

            Assert.NotEqual(0, num);
        }
        public void CreateDiceTest()
        {
            int   num  = 4;
            IDice dice = DiceFactory.CreateDice(num);

            Assert.True(dice.HasSides);
            Assert.Equal(num, dice.Sides.Count());
            Assert.Equal(num, dice.NumberOfSides);
        }
Exemplo n.º 4
0
 public void Test_Aurora_Score_Factory()
 {
     for (int i = 1; i < 7; i++)
     {
         var dice = DiceFactory.CreateDice(i);
         Assert.IsNotNull(dice, "DiceFactory must create a valid Dice for values between 1 and 6");
         Assert.IsTrue(dice.Value == i, "The created Dice must contains same value as the CreateDice parameter value.");
     }
 }
Exemplo n.º 5
0
 public AuroraScoreUnitTest()
 {
     AuroraPlays = new List <Dice[]>();
     for (int i = 0; i < 6; i++)
     {
         AuroraPlays.Add(new Dice[5]);
         var dice = DiceFactory.CreateDice(i + 1);
         for (int j = 0; j < 5; j++)
         {
             AuroraPlays[i][j] = dice;
         }
     }
 }
        public void RoleDiceForSuccessFiftyTest()
        {
            IDice dice       = DiceFactory.CreateDice(4);
            bool  wasFial    = false;
            bool  wasSuccess = false;

            for (int i = 0; i < 100; i++)
            {
                if (dice.RoleDiceForSuccess(OddType.Fifty))
                {
                    wasSuccess = true;
                }
                else
                {
                    wasFial = true;
                }
            }
            Assert.True(wasSuccess && wasFial);
        }
Exemplo n.º 7
0
 public static IEnumerable <Dice> NewRange(IEnumerable <int> values)
 {
     return(values.Select(v => DiceFactory.CreateDice(v)));
 }
Exemplo n.º 8
0
 public static Dice New(int diceNum)
 {
     return(DiceFactory.CreateDice(diceNum));
 }