Exemplo n.º 1
0
 public void CopyToWithInsufficientSizeArray()
 {
     LinkedList ll = new LinkedList();
     ll.Add("item1");
     ll.Add("item2");
     string[] strings = new string[2];
     ll.CopyTo(strings, 1);
 }
Exemplo n.º 2
0
 public void CopyToWithIndexGreaterThanArrayLength()
 {
     LinkedList ll = new LinkedList();
     ll.Add("item1");
     string[] strings = new string[1];
     ll.CopyTo(strings, 2);
 }
Exemplo n.º 3
0
 public void CopyToWithZeroIndex()
 {
     LinkedList ll = new LinkedList();
     ll.Add("item1");
     ll.Add("item2");
     ll.Add("item3");
     string[] strings = new string[3];
     ll.CopyTo(strings, 0);
     Assert.IsTrue(strings[0].Equals("item1"), "Expected first element to be \"item1\" not " + strings[0]);
     Assert.IsTrue(strings[1].Equals("item2"), "Expected second element to be \"item2\" not " + strings[1]);
     Assert.IsTrue(strings[2].Equals("item3"), "Expected third element to be \"item3\" not " + strings[2]);
 }
Exemplo n.º 4
0
 public void CopyToWithNullArray()
 {
     LinkedList ll = new LinkedList();
     ll.Add("item1");
     ll.CopyTo(null, 0);
 }
Exemplo n.º 5
0
 public void CopyToWithNonZeroIndex()
 {
     LinkedList ll = new LinkedList();
     ll.Add("item1");
     ll.Add("item2");
     ll.Add("item3");
     string[] strings = new string[5];
     strings[0] = "string1";
     strings[1] = "string2";
     ll.CopyTo(strings, 2);
     Assert.IsTrue(strings[0].Equals("string1"), "Expected first element to be \"string1\" not " + strings[0]);
     Assert.IsTrue(strings[1].Equals("string2"), "Expected second element to be \"string2\" not " + strings[1]);
     Assert.IsTrue(strings[2].Equals("item1"), "Expected third element to be \"item1\" not " + strings[2]);
     Assert.IsTrue(strings[3].Equals("item2"), "Expected fourth element to be \"item2\" not " + strings[3]);
     Assert.IsTrue(strings[4].Equals("item3"), "Expected fifth element to be \"item3\" not " + strings[4]);
 }
Exemplo n.º 6
0
 public void CopyToWithNegativeIndex()
 {
     LinkedList ll = new LinkedList();
     ll.Add("item1");
     string[] strings = new string[1];
     ll.CopyTo(strings, -1);
 }