public void CopyToTest() { KeyValuePair <int, int>[] array; using (FileBackedDictionary <int, int> dictionary = new FileBackedDictionary <int, int>()) { for (int i = 1; i <= 100; i++) { dictionary.Add(i, i); } Assert.AreEqual(dictionary.Count, 100); array = new KeyValuePair <int, int> [dictionary.Count]; dictionary.CopyTo(array, 0); foreach (KeyValuePair <int, int> kvp in array) { Assert.IsTrue(dictionary.Contains(kvp), kvp.Key.ToString()); Assert.AreEqual(dictionary[kvp.Key], kvp.Value); } } }
public void CopyToTest() { KeyValuePair<int, int>[] array; using (FileBackedDictionary<int, int> dictionary = new FileBackedDictionary<int, int>()) { for (int i = 1; i <= 100; i++) dictionary.Add(i, i); Assert.AreEqual(dictionary.Count, 100); array = new KeyValuePair<int, int>[dictionary.Count]; dictionary.CopyTo(array, 0); foreach (KeyValuePair<int, int> kvp in array) { Assert.IsTrue(dictionary.Contains(kvp), kvp.Key.ToString()); Assert.AreEqual(dictionary[kvp.Key], kvp.Value); } } }