Example #1
0
 public void SixSidedDiceReturnsRangeFromOneToSixTest()
 {
     IDie sixSided = new SixSidedDie();
     int rollResult = sixSided.DieRoll;
     Console.Write(string.Format("Six sided test result: {0}",rollResult));
     Assert.That(rollResult, Is.InRange(1, 6));
 }
Example #2
0
 public void SixSidedDiceCanRollNumberTest()
 {
     IDie sixSided = new SixSidedDie();
     int rollResult = sixSided.DieRoll;
     Assert.That(rollResult, Is.Not.Null);
     Assert.That(rollResult, Is.GreaterThan(0));
 }
Example #3
0
 public void MultipleSixSidedDiceRollsAreInCorrectRangeTest()
 {
     IDie sixSided = new SixSidedDie();
     int i = 0;
     List<int> totals = new List<int>();
     while (i < 1000)
     {
         int total = 0;
         for (int a = 0; a < 3; a++)
         {
             // Thread.Sleep(10);
             total += SixSidedDie.staticDieRoll;
         }
         totals.Add(total);
         i++;
     }
     List<int> totalsCount = new List<int>();
     for (int j = 0; j < 18; j++)
     {
         Console.WriteLine(string.Format("The number {0} has come up {1} time(s)", j, totals.Where(x => x == j).Count()));
         totalsCount.Add(totals.Where(x => x == j).Count());
     }
     Console.WriteLine(string.Join(",", totalsCount.ToArray()));
     string blah = string.Empty;
     //List<SixSidedDie> diceSet = new List<SixSidedDie>
     //{
     //    new SixSidedDie(),
     //    new SixSidedDie(),
     //    new SixSidedDie()
     //};
     //Assert.That(diceSet[0].DieRoll, Is.InRange(1, 6));
     //Assert.That(diceSet[1].DieRoll, Is.InRange(1, 6));
     //Assert.That(diceSet[2].DieRoll, Is.InRange(1, 6));
 }
Example #4
0
 public void MultipleSixSidedDiceRollsAreInCorrectRangeTest()
 {
     IDie sixSided = new SixSidedDie();
     List<SixSidedDie> diceSet = new List<SixSidedDie>
     {
         new SixSidedDie(),
         new SixSidedDie(),
         new SixSidedDie()
     };
     Assert.That(diceSet[0].DieRoll, Is.InRange(1, 6));
     Assert.That(diceSet[1].DieRoll, Is.InRange(1, 6));
     Assert.That(diceSet[2].DieRoll, Is.InRange(1, 6));
 }
Example #5
0
 public void CanInstantiateSixSidedDiceTest()
 {
     IDie sixSided = new SixSidedDie();
     Assert.That(sixSided, Is.Not.Null);
 }