public void CopyTo() { var trie = new StringTrie <bool> { { "ABC", true }, { "AB", false }, { "ADE", true }, { "ABCDE", false } }; var destinationArray = new KeyValuePair <string, bool> [6]; trie.CopyTo(destinationArray, 1); var result = destinationArray.Where(i => i.Key != null).OrderBy(i => i.Key).ToArray(); var expected = new[] { new KeyValuePair <string, bool>("AB", false), new KeyValuePair <string, bool>("ABC", true), new KeyValuePair <string, bool>("ABCDE", false), new KeyValuePair <string, bool>("ADE", true) }; Assert.Equal(new KeyValuePair <string, bool>(), destinationArray[0]); Assert.Equal(new KeyValuePair <string, bool>(), destinationArray[^ 1]);