public string s;
public string a;
}
+
+ class DataEqual
+ {
+ public override bool Equals (object obj)
+ {
+ return true;
+ }
+ }
+
//End Auxiliary Things
[TestFixture]
Assert("#E38", copy[3] != orig[3]);
}
+ [Test]
+ [ExpectedException (typeof (InvalidCastException))]
+ public void Copy_InvalidCast () {
+ object[] arr1 = new object [10];
+ Type[] arr2 = new Type [10];
+
+ arr1 [0] = new object ();
+
+ Array.Copy (arr1, 0, arr2, 0, 10);
+ }
+
[Test]
public void TestCopyTo() {
{
AssertEquals("#J50", 3, Array.IndexOf(s1, "a", 1, 3));
}
+ [Test]
+ public void TestIndexOf_CustomEqual ()
+ {
+ DataEqual[] test = new DataEqual [] { new DataEqual () };
+ AssertEquals (0, Array.IndexOf (test, "asdfas", 0));
+
+ IList array = (IList)test;
+ AssertEquals (0, array.IndexOf ("asdfas"));
+ }
+
[Test]
public void TestLastIndexOf1() {
{
AssertEquals("#K05", 0, Array.LastIndexOf(s1, "this"));
AssertEquals("#K06", 4, Array.LastIndexOf(s1, "test"));
AssertEquals("#K07", 3, Array.LastIndexOf(s1, "a"));
+
+ AssertEquals (-1, Array.LastIndexOf (new String [0], "foo"));
}
[Test]
}
[Test]
- [ExpectedException (typeof (ArgumentOutOfRangeException))]
public void TestLastIndexOf4 ()
{
short [] a = new short [] { 19, 238, 317, 6, 565, 0, -52, 60, -563, 753, 238, 238};
- Array.LastIndexOf (a, 16, -1);
+ try {
+ Array.LastIndexOf (a, (object)16, -1);
+ 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]