示例#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);
            }
        }