public void Copy() { KeyValuePair <int, string>[] data = new KeyValuePair <int, string> [5]; HashMap <int, string> map = new HashMap <int, string>(); KeyValuePair <int, string>[] expected = new KeyValuePair <int, string>[] { new KeyValuePair <int, string>(4, "d"), new KeyValuePair <int, string>(5, "e"), new KeyValuePair <int, string>(1, "a"), new KeyValuePair <int, string>(2, "b"), new KeyValuePair <int, string>(3, "c") }; map.Add(1, "a"); map.Add(2, "b"); map.Add(3, "c"); data[0] = new KeyValuePair <int, string>(4, "d"); data[1] = new KeyValuePair <int, string>(5, "e"); map.CopyTo(data, 2); Assert.Equal(expected, data); }