public void CopyToWithInsufficientSizeArray() { LinkedList ll = new LinkedList(); ll.Add("item1"); ll.Add("item2"); string[] strings = new string[2]; Assert.Throws<ArgumentException>(() => ll.CopyTo(strings, 1)); }
public void CopyToWithNegativeIndex() { LinkedList ll = new LinkedList(); ll.Add("item1"); string[] strings = new string[1]; Assert.Throws<ArgumentOutOfRangeException>(() => ll.CopyTo(strings, -1)); }
public void CopyToWithIndexGreaterThanArrayLength() { LinkedList ll = new LinkedList(); ll.Add("item1"); string[] strings = new string[1]; Assert.Throws<ArgumentOutOfRangeException>(() => ll.CopyTo(strings, 2)); }
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]); }
public void CopyToWithNullArray() { LinkedList ll = new LinkedList(); ll.Add("item1"); Assert.Throws<ArgumentNullException>(() => ll.CopyTo(null, 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]); }
public void CopyToWithInsufficientSizeArray() { LinkedList ll = new LinkedList(); ll.Add("item1"); ll.Add("item2"); string[] strings = new string[2]; ll.CopyTo(strings, 1); }
public void CopyToWithIndexGreaterThanArrayLength() { LinkedList ll = new LinkedList(); ll.Add("item1"); string[] strings = new string[1]; ll.CopyTo(strings, 2); }
public void CopyToWithNegativeIndex() { LinkedList ll = new LinkedList(); ll.Add("item1"); string[] strings = new string[1]; ll.CopyTo(strings, -1); }
public void CopyToWithNullArray() { LinkedList ll = new LinkedList(); ll.Add("item1"); ll.CopyTo(null, 0); }