Example #1
0
        public void NextBytesReturnsTopOfBytesArrayQueue()
        {
            byte[] target = new byte[] { 0x1, 0x2, 0x3, 0x4 };
            TestRandom rand = new TestRandom();
            rand.ByteArrayQueue.Enqueue(target);

            byte[] result = new byte[4];
            rand.NextBytes(result);

            CollectionAssert.AreEqual(target, result, "The two arrays should be the same.");
        }
Example #2
0
        public void NextBytesPopsTheTopOfTheBytesArrayQueue()
        {
            byte[] target = new byte[] { 0x1, 0x2, 0x3, 0x4 };
            TestRandom rand = new TestRandom();
            rand.ByteArrayQueue.Enqueue(target);

            if(rand.ByteArrayQueue.Count != 1)
                Assert.Fail("Unable to determine the size of ByteArrayQueue.");

            byte[] result = new byte[4];
            rand.NextBytes(result);

            Assert.AreEqual(0, rand.ByteArrayQueue.Count, "The number of items left in ByteArrayQueue should be zero.");
        }