コード例 #1
0
        public void InsertTwoElementInObjectArrayWithDefaltConstructor()
        {
            var array = new ArrayClass<string>();
            var count = array.GetCount();
            array.Insert("m", count);
            count = array.GetCount();
            Assert.AreEqual(1, count);

            array.Insert("c", count);
            count = array.GetCount();

            Assert.AreEqual(2, count);
        }
コード例 #2
0
        public void InsertStringElementInObjectArrayWithLength8()
        {
            var data = new string[] { "a", "b", "d", "c", "f", null, null, null };
            var newElement = "m";

            var array = new ArrayClass<string>(data, 8);
            array.Insert(newElement, 2);
            var count = array.GetCount();

            Assert.AreEqual(9, count);
        }
コード例 #3
0
        public void InsertIntElementInObjectArrayWithLength8()
        {
            var data = new int[] { 1, 2, 3, 4, 5, 6, 7, 8 };
            var newElement = 1;

            var array = new ArrayClass<int>(data, 8);
            array.Insert(newElement, 2);
            var count = array.GetCount();

            Assert.AreEqual(9, count);
        }
コード例 #4
0
        public void InsertIntElementInObjectArrayWithIndexOutOfRAnge()
        {
            var intArray = new int[] { 1, 2, 3, 0, 0, 0, 0, 0 };
            var newElement = 5;

            var array = new ArrayClass<int>(intArray, 3);
            array.Insert(newElement, 10);
            var count = array.GetCount();

            Assert.AreEqual(3, count);
        }
コード例 #5
0
        public void InsertIntElementInObjectArrayWithElementOfIndexNull()
        {
            var intArray = new int[] { 1, 2, 3, 0, 0, 0, 0, 0 };
            var newElement = 5;

            var array = new ArrayClass<int>(intArray, 3);
            array.Insert(newElement, 4);
            var count = array.GetCount();

            Assert.AreEqual(4, count);
        }
コード例 #6
0
        public void InsertIntElementInObjectArray()
        {
            var intArray = new int[] { 1, 2, 3, 0, 0, 0, 0, 0 };
            var newElement = 1;

            var array = new ArrayClass<int>(intArray, 3);
            array.Insert(newElement, 2);
            var count = array.GetCount();
            var data = array.GetData(2);

            Assert.AreEqual(4, count);
            Assert.AreEqual(1, data);
        }