public void CopyTo() { WordInfoCollection collection = new WordInfoCollection(); WordInfo mi1 = new WordInfo("continuous", 0, 0, WordLocation.Content); WordInfo mi2 = new WordInfo("goose", 34, 0, WordLocation.Content); collection.Add(mi1); collection.Add(mi2); WordInfo[] matches = new WordInfo[2]; collection.CopyTo(matches, 0); Assert.AreEqual(mi1, matches[0], "Wrong match item"); Assert.AreEqual(mi2, matches[1], "Wrong match item"); matches = new WordInfo[3]; collection.CopyTo(matches, 0); Assert.AreEqual(mi1, matches[0], "Wrong match item"); Assert.AreEqual(mi2, matches[1], "Wrong match item"); Assert.IsNull(matches[2], "Non-null item"); matches = new WordInfo[3]; collection.CopyTo(matches, 1); Assert.IsNull(matches[0], "Non-null item"); Assert.AreEqual(mi1, matches[1], "Wrong match item"); Assert.AreEqual(mi2, matches[2], "Wrong match item"); }
public void CopyTo() { WordInfoCollection sut = new WordInfoCollection(); WordInfo mi1 = new WordInfo("continuous", 0, 0, WordLocation.Content); WordInfo mi2 = new WordInfo("goose", 34, 0, WordLocation.Content); sut.Add(mi1); sut.Add(mi2); WordInfo[] matches = new WordInfo[2]; sut.CopyTo(matches, 0); Assert.Equal(mi1, matches[0]); Assert.Equal(mi2, matches[1]); matches = new WordInfo[3]; sut.CopyTo(matches, 0); Assert.Equal(mi1, matches[0]); Assert.Equal(mi2, matches[1]); Assert.Null(matches[2]); matches = new WordInfo[3]; sut.CopyTo(matches, 1); Assert.Null(matches[0]); Assert.Equal(mi1, matches[1]); Assert.Equal(mi2, matches[2]); }
public void CopyTo_Array_Null() { WordInfoCollection sut = new WordInfoCollection(); var ex = Assert.Throws <ArgumentNullException>(() => sut.CopyTo(null, 0)); Assert.Equal("Value cannot be null.\r\nParameter name: array", ex.Message); }
public void CopyTo_InvalidIndex_TooBig() { WordInfoCollection collection = new WordInfoCollection(); WordInfo[] results = new WordInfo[10]; Assert.Throws <ArgumentOutOfRangeException>(() => collection.CopyTo(results, 10)); }
public void CopyTo_InvalidIndex_TooBig() { WordInfoCollection collection = new WordInfoCollection(); WordInfo[] results = new WordInfo[10]; collection.CopyTo(results, 10); }
public void CopyTo_InvalidIndex_Negative() { WordInfoCollection collection = new WordInfoCollection(); WordInfo[] results = new WordInfo[10]; collection.CopyTo(results, -1); }
public void CopyTo_Index_TooBig() { WordInfoCollection sut = new WordInfoCollection(); WordInfo[] results = new WordInfo[10]; var ex = Assert.Throws <ArgumentOutOfRangeException>(() => sut.CopyTo(results, 10)); Assert.Equal("Index should be greater than or equal to zero and less than the number of items in the array.\r\nParameter name: arrayIndex", ex.Message); }
public void CopyTo_NoSpaceAtIndex() { WordInfoCollection collection = new WordInfoCollection(); WordInfo mi1 = new WordInfo("home", 0, 0, WordLocation.Content); WordInfo mi2 = new WordInfo("taskbar", 100, 0, WordLocation.Content); collection.Add(mi1); collection.Add(mi2); WordInfo[] matches = new WordInfo[2]; Assert.Throws <ArgumentOutOfRangeException>(() => collection.CopyTo(matches, 1)); }
public void CopyTo_NoSpaceAtIndex() { WordInfoCollection collection = new WordInfoCollection(); WordInfo mi1 = new WordInfo("home", 0, 0, WordLocation.Content); WordInfo mi2 = new WordInfo("taskbar", 100, 0, WordLocation.Content); collection.Add(mi1); collection.Add(mi2); WordInfo[] matches = new WordInfo[2]; collection.CopyTo(matches, 1); }
public void CopyTo_ArrayTooSmall() { WordInfoCollection collection = new WordInfoCollection(); WordInfo mi1 = new WordInfo("home", 0, 0, WordLocation.Content); WordInfo mi2 = new WordInfo("taskbar", 100, 0, WordLocation.Content); collection.Add(mi1); collection.Add(mi2); WordInfo[] matches = new WordInfo[1]; collection.CopyTo(matches, 0); }
public void CopyTo_Index_TooSmall() { WordInfoCollection sut = new WordInfoCollection(); WordInfo mi1 = new WordInfo("home", 0, 0, WordLocation.Content); WordInfo mi2 = new WordInfo("taskbar", 100, 0, WordLocation.Content); sut.Add(mi1); sut.Add(mi2); WordInfo[] matches = new WordInfo[1]; var ex = Assert.Throws <ArgumentOutOfRangeException>(() => sut.CopyTo(matches, 0)); Assert.Equal("Not enough space for copying the items starting at the specified index.\r\nParameter name: arrayIndex", ex.Message); }
public void CopyTo_NullArray() { WordInfoCollection collection = new WordInfoCollection(); collection.CopyTo(null, 0); }
public void CopyTo_NullArray() { WordInfoCollection collection = new WordInfoCollection(); Assert.That(() => collection.CopyTo(null, 0), Throws.ArgumentNullException); }