Esempio n. 1
0
        public void ArrayNullCopyToMethodException()
        {
            var test = new LinkedListCollection <int>();

            int[] testArray = null;
            test.Add(1);
            test.Add(2);
            Assert.Throws <ArgumentNullException>(() => test.CopyTo(testArray, 0));
        }
Esempio n. 2
0
        public void NegativeIndexCopyToMethodException()
        {
            var test = new LinkedListCollection <int>();

            int[] testArray = new int[4];
            test.Add(1);
            test.Add(2);
            Assert.Throws <ArgumentOutOfRangeException>(() => test.CopyTo(testArray, -1));
        }
        public void ValidatesCopyToMethod()
        {
            var list = new LinkedListCollection <int> {
                1, 2, 3
            };
            var array = new int[3];

            list.CopyTo(array, 0);
            LinkedListNode <int> node = list.GetFirst;

            foreach (var x in array)
            {
                Assert.Equal(x, node.Value);
                node = node.Next;
            }
        }