public void CopyTo_InvalidArgument_ThrowsException() { var dict = new ListMultiDictionary <int, int> { [3] = new[] { 1, 2, 3 } }; Assert.ThrowsException <ArgumentNullException>(() => dict.CopyTo(null, 0)); Assert.ThrowsException <ArgumentOutOfRangeException>(() => dict.CopyTo(new KeyValuePair <int, IReadOnlyCollection <int> > [1], -1)); Assert.ThrowsException <ArgumentOutOfRangeException>(() => dict.CopyTo(new KeyValuePair <int, IReadOnlyCollection <int> > [1], 2)); Assert.ThrowsException <ArgumentOutOfRangeException>(() => dict.CopyTo(new KeyValuePair <int, IReadOnlyCollection <int> > [1], 1)); }
public void CopyTo() { var dict = new ListMultiDictionary <int, int> { [3] = new[] { 1, 2, 3 } }; var arr = new KeyValuePair <int, IReadOnlyCollection <int> > [1]; dict.CopyTo(arr, 0); var kv = arr[0]; Assert.AreEqual(3, kv.Key); Assert.IsTrue(kv.Value.SequenceEqual(new[] { 1, 2, 3 })); }