예제 #1
0
 public void TestBoundedQueueCopyToNullArray()
 {
     Assert.Throws <ArgumentNullException>(
         () =>
     {
         BoundedQueue <int> queue = new BoundedQueue <int>(Enumerable.Range(0, 10), 5);
         queue.CopyTo(null, 0);
     });
 }
예제 #2
0
        public void TestBoundedQueueConstructedWithEnumrable()
        {
            BoundedQueue <int> queue = new BoundedQueue <int>(Enumerable.Range(0, 10), 5);

            Assert.True(queue.Count == 5);
            int[] array = new int[10];
            queue.CopyTo(array, 1);
            Assert.True(array[0] == 0);
            for (int i = 0; i < 5; i++)
            {
                Assert.True(array[i + 1] == i);
            }
        }