public void NongenericCopyTo_WrongType_ActsLikeList() { var destination = new IList[3]; var list = new List <int>(new[] { 1, 2, 3 }) as IList; Assert.Throws <ArgumentException>(() => list.CopyTo(destination, 0)); var deque = new Deque <int>(new[] { 1, 2, 3 }) as IList; Assert.Throws <ArgumentException>(() => deque.CopyTo(destination, 0)); }
public void NongenericCopyTo_MultidimensionalArray_ActsLikeList() { var destination = new int[3, 3]; var list = new List <int>(new[] { 1, 2, 3 }) as IList; Assert.Throws <ArgumentException>(() => list.CopyTo(destination, 0)); var deque = new Deque <int>(new[] { 1, 2, 3 }) as IList; Assert.Throws <ArgumentException>(() => deque.CopyTo(destination, 0)); }
public void NongenericCopyTo_NegativeOffset_ActsLikeList() { var destination = new int[3]; var list = new List <int>(new[] { 1, 2, 3 }) as IList; Assert.Throws <ArgumentOutOfRangeException>(() => list.CopyTo(destination, -1)); var deque = new Deque <int>(new[] { 1, 2, 3 }) as IList; Assert.Throws <ArgumentOutOfRangeException>(() => deque.CopyTo(destination, -1)); }