using System.Collections;
using System.Globalization;
using System.Reflection;
-
-#if NET_2_0
using System.Collections.Generic;
-#endif
namespace MonoTests.System
{
}
[Test]
-#if NET_2_0
[ExpectedException (typeof (ArgumentNullException))]
-#else
- [ExpectedException (typeof (NullReferenceException))]
-#endif
public void TestCreateInstance2b ()
{
Array.CreateInstance (typeof (Int32), (long[])null);
}
[Test]
-#if NET_2_0
[ExpectedException (typeof (ArgumentNullException))]
-#else
- [ExpectedException (typeof (NullReferenceException))]
-#endif
public void TestGetValueLongArray ()
{
char[] c = new Char[2];
NUnit.Framework.Assert.Fail ("#1");
} catch (ArgumentOutOfRangeException) { }
-#if NET_2_0
try {
Array.LastIndexOf<short> (a, 16, -1);
NUnit.Framework.Assert.Fail ("#2");
} catch (ArgumentOutOfRangeException) { }
-#endif
}
[Test]
}
[Test]
-#if NET_2_0
[ExpectedException (typeof (ArgumentNullException))]
-#else
- [ExpectedException (typeof (NullReferenceException))]
-#endif
public void TestSetValueLongArray ()
{
char[] c = new Char[2];
Assert.IsTrue (!comparer.Called, "Called");
}
-#if NET_2_0
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void AsReadOnly_NullArray ()
test = new List<object>(test);
Assert.AreEqual (test.Contains (null), false, "array with test");
}
+
+ [Test]
+ public void IListNull ()
+ {
+ IList<object> test;
+
+ test = new List<object>();
+ Assert.AreEqual (-1, test.IndexOf (null), "list<o>");
+
+ test = new object[] {};
+ Assert.AreEqual (-1, test.IndexOf (null), "empty array");
+
+ test = new object[] {null};
+ Assert.AreEqual (0, test.IndexOf (null), "array with null");
+
+ test = new object[] { 1, null};
+ Assert.AreEqual (1, test.IndexOf (null), "array with last null");
+
+ test = new List<object>(test);
+ Assert.AreEqual (1, test.IndexOf (null), "List<object> with test");
+
+ test = new object[] {new object()};
+ Assert.AreEqual (-1, test.IndexOf (null), "array with object");
+
+ test = new List<object>(test);
+ Assert.AreEqual (-1, test.IndexOf (null), "array with test");
+ }
+
#endif // TARGET_JVM
-#endif
#region Bug 80299
#endregion
-#if NET_2_0
[Test] // bug #322248
public void IEnumerator_Reset ()
{
Assert.IsTrue (arr.IsReadOnly);
}
-#endif
[Test]
[ExpectedException (typeof (NotSupportedException))]