Beispiel #1
0
 public void TestCopyTo_Copies()
 {
     var list = new TypedList<ArrayList, int>(new ArrayList() { 1, 2, 3, 4, 5 });
     int[] array = new int[5];
     int arrayIndex = 0;
     list.CopyTo(array, arrayIndex);
     int[] expected = { 1, 2, 3, 4, 5 };
     Assert.IsTrue(expected.ToSublist().IsEqualTo(array.ToSublist()), "The items were not copied as expected.");
 }
Beispiel #2
0
 public void TestCopyTo_IncompatibleType_Throws()
 {
     var list = new TypedList<ArrayList, int>(new ArrayList() { 1, 2, "3", 4, 5 });
     int[] array = new int[5];
     int arrayIndex = 0;
     list.CopyTo(array, arrayIndex);
 }
Beispiel #3
0
 public void TestCopyTo_NotEnoughSpaceRemaining_Throws()
 {
     var list = new TypedList<ArrayList, int>(new ArrayList() { 1 });
     int[] array = new int[1];
     int arrayIndex = 1;
     list.CopyTo(array, arrayIndex);
 }
Beispiel #4
0
 public void TestCopyTo_NullArray_Throws()
 {
     var list = new TypedList<ArrayList, int>(new ArrayList());
     int[] array = null;
     int arrayIndex = 0;
     list.CopyTo(array, arrayIndex);
 }
Beispiel #5
0
 public void TestCopyTo_NegativeArrayIndex_Throws()
 {
     var list = new TypedList<ArrayList, int>(new ArrayList());
     int[] array = new int[0];
     int arrayIndex = -1;
     list.CopyTo(array, arrayIndex);
 }