public void InsertObjectsTest() { var v1 = (NSString)"1"; var v2 = (NSString)"2"; var v3 = (NSString)"3"; var v4 = (NSString)"4"; using (var arr = new NSMutableArray <NSString> (v1, v2)) { var iset = new NSMutableIndexSet(); iset.Add(1); iset.Add(2); Assert.Throws <ArgumentNullException> (() => arr.InsertObjects((NSString[])null, iset), "InsertObjects ANE 1"); Assert.AreEqual(2, arr.Count, "Count 1"); Assert.Throws <ArgumentNullException> (() => arr.InsertObjects(new NSString [] { null, null }, iset), "InsertObjects ANE 2"); Assert.AreEqual(2, arr.Count, "Count 2"); Assert.Throws <ArgumentNullException> (() => arr.InsertObjects(new NSString [] { v1, null }, iset), "InsertObjects ANE 3"); Assert.AreEqual(2, arr.Count, "Count 3"); Assert.Throws <ArgumentNullException> (() => arr.InsertObjects(new NSString [] { v1 }, null), "InsertObjects ANE 4"); Assert.AreEqual(2, arr.Count, "Count 4"); arr.InsertObjects(new NSString [] { v3, v4 }, iset); Assert.AreEqual(4, arr.Count, "InsertObjects 1"); Assert.AreSame(v1, arr [0], "a [0]"); Assert.AreSame(v3, arr [1], "a [1]"); Assert.AreSame(v4, arr [2], "a [2]"); Assert.AreSame(v2, arr [3], "a [3]"); iset.Clear(); iset.Add(9); Assert.Throws <IndexOutOfRangeException> (() => arr.InsertObjects(new NSString [] { v1 }, iset), "InsertObjects ANE 5"); } }