public void NextReturnsTopOfIntQueue() { TestRandom rand = new TestRandom(); rand.IntQueue.Enqueue(101); Assert.AreEqual(101, rand.Next(), "The result of Next should have been the top of the IntQueue"); }
public void NextPopsTheTopOfTheIntQueue() { TestRandom rand = new TestRandom(); rand.IntQueue.Enqueue(0); if(rand.IntQueue.Count != 1) Assert.Fail("Unable to determine the size of IntQueue."); rand.Next(); Assert.AreEqual(0, rand.IntQueue.Count, "The number of items left in IntQueue should be zero."); }
public void NextMinMaxTruncatesValueInIntQueueMin() { TestRandom rand = new TestRandom(); rand.IntQueue.Enqueue(-1); int minValue = 0; int result = rand.Next(minValue, 100); Assert.AreEqual(minValue, result, "The result should have been equal to minValue because the min value represents an inclusive lower bound."); }
public void NextMinMaxTruncatesValueInIntQueueMax() { TestRandom rand = new TestRandom(); rand.IntQueue.Enqueue(101); int maxValue = 100; int result = rand.Next(0, maxValue); Assert.AreEqual(maxValue - 1, result, "The result should have been (maxvalue - 1) because the max value represents an exclusive upper bound."); }
public void NextMinMaxReturnsNextItemInIntQueue() { TestRandom rand = new TestRandom(); rand.IntQueue.Enqueue(100); int result = rand.Next(0, 101); Assert.AreEqual(100, result); }
public void NextMinMaxPopsIntQueue() { TestRandom rand = new TestRandom(); rand.IntQueue.Enqueue(100); if(rand.IntQueue.Count != 1) Assert.Fail("Unable to determine the size of IntQueue."); rand.Next(0, 101); Assert.AreEqual(0, rand.IntQueue.Count, "The number of items in IntQueue should be zero."); }