Exemple #1
0
        public void CopyTo_Test_Strings()
        {
            var list = new DoubleCircularLinkedList <string> {
                "a", "b", "c", "d", "e"
            };

            string[] arr   = new string[10];
            string[] array = { null, null, "a", "b", "c", "d", "e", null, null, null };
            list.CopyTo(arr, 2);
            Assert.Equal(array, arr);
        }
Exemple #2
0
        public void CopyTo_Test_Int()
        {
            var list = new DoubleCircularLinkedList <int> {
                1, 2, 3, 4, 5
            };

            int[]  arr   = new int[8];
            int [] array = { 0, 0, 0, 1, 2, 3, 4, 5 };
            list.CopyTo(arr, 3);
            Assert.Equal(array, arr);
        }
Exemple #3
0
        public void CopyTo_ArgumentException_Strings()
        {
            var list = new DoubleCircularLinkedList <string> {
                "a", "b", "c", "d", "e"
            };

            string[] array = new string[7];

            var exception = Assert.Throws <ArgumentException>(() => list.CopyTo(array, 3));

            Assert.Equal("Array length too small", exception.Message);
        }
Exemple #4
0
        public void CopyTo_ArgumentOutOfRangeException_IndexBigger_Than_ArrayLength()
        {
            var list = new DoubleCircularLinkedList <string> {
                "a", "b", "c"
            };

            string[] array = new string[5];

            var exception = Assert.Throws <ArgumentOutOfRangeException>(() => list.CopyTo(array, 6));

            Assert.Equal("Specified argument was out of the range of valid values.\r\nParameter name: index", exception.Message);
        }
Exemple #5
0
        public void CopyTo_ArgumentNullException_Strings()
        {
            var list = new DoubleCircularLinkedList <string> {
                "a", "b", "c", "d", "e"
            };

            string[] array = null;

            var exception = Assert.Throws <ArgumentNullException>(() => list.CopyTo(array, 2));

            Assert.Equal("Value cannot be null.\r\nParameter name: index", exception.Message);
        }