Beispiel #1
0
        public void Insert()
        {
            using (var arr = new SwiftArray <ulong> (9, 8, 7, 6, 5, 4, 3, 2, 1)) {
                arr.Insert(4, 20);
                Assert.AreEqual(10, arr.Count, "Count 1");
                CollectionAssert.AreEqual(new ulong [] { 9, 8, 7, 6, 20, 5, 4, 3, 2, 1 }, arr, "Items 1");
                Assert.AreEqual(20, arr [4], "Item 4");

                Assert.Throws <ArgumentOutOfRangeException> (() => arr.Insert(-1, 100), "Insert Ex 1");
                Assert.Throws <ArgumentOutOfRangeException> (() => arr.Insert(11, 100), "Insert Ex 2");

                arr.Dispose();
                Assert.Throws <ObjectDisposedException> (() => arr.Insert(11, 100), "Insert ODE");
            }
        }