/// <summary> /// Test CopyTo. /// </summary> /// <typeparam name="TKey">Key type of the dictionary.</typeparam> /// <typeparam name="TValue">Value type of the dictionary.</typeparam> /// <param name="dictionary">The dictionary to test.</param> /// <param name="key">Key that is present in the dictionary.</param> /// <param name="value">Value associated with the key in the dictionary.</param> private static void TestDictionaryCopyTo <TKey, TValue>(PersistentDictionary <TKey, TValue> dictionary, TKey key, TValue value) where TKey : IComparable <TKey> { var kvp = new KeyValuePair <TKey, TValue>(key, value); var elements = new KeyValuePair <TKey, TValue> [1]; dictionary.CopyTo(elements, 0); Assert.AreEqual(kvp, elements[0], "CopyTo failed"); var keys = new TKey[1]; dictionary.Keys.CopyTo(keys, 0); Assert.AreEqual(key, keys[0], "Keys.CopyTo failed"); var values = new TValue[1]; dictionary.Values.CopyTo(values, 0); Assert.AreEqual(value, values[0], "values.CopyTo failed"); }