Ejemplo n.º 1
0
 public void TestDieRollRange()
 {
     Die die = new Die();
     int roll = die.roll();
     //Test that roll is between 1 & 6
     Assert.LessOrEqual(roll, 6);
     Assert.GreaterOrEqual(roll, 1);
 }
Ejemplo n.º 2
0
 public void testRandomness4Fail1in6()
 {
     //Test randomness that should fail on average 1 in 6 times
     Die die = new Die();
     int numberToTest = 4;
     int roll = die.roll();
     Assert.AreNotEqual(roll, numberToTest);
     numberToTest = roll;
 }
Ejemplo n.º 3
0
 public void TestDieRollOneThousandRange()
 {
     Die die = new Die();
     for (int i = 0; i < 1000; i++)
     {
         int roll = die.roll();
         Assert.LessOrEqual(roll, 6);
         Assert.GreaterOrEqual(roll, 1);
     }
 }
Ejemplo n.º 4
0
 public void testToString()
 {
     Die die = new Die();
     //test that toString converts last roll of die same as converting result of roll to string
     int roll = die.roll();
     Assert.AreEqual(roll.ToString(), die.ToString());
 }
Ejemplo n.º 5
0
 public void testRandomnessRandomOutputManyDice()
 {
     Console.WriteLine("Random Numbers: ");
     for (int i = 0; i < 1000; i++)
     {
         Die die = new Die();
         Console.WriteLine(die.roll().ToString());//outputs 1000 random numbers
     }
 }