public void TestDictionaryCopyTo()
{
AssertDictionaryException(delegate(IDictionary<string, string> dict)
{
dict.CopyTo(null, 10);
}, new string[] { "10", "null", "array" });
AssertDictionaryException(delegate(IDictionary<string, string> dict)
{
KeyValuePair<string,string>[] arr = new KeyValuePair<string, string>[10];
dict.CopyTo(arr, -1);
}, new string[] { "less", "zero", "array", "-1" });
AssertDictionaryNoException(delegate(IDictionary<string, string> dict)
{
KeyValuePair<string, string>[] arr = new KeyValuePair<string, string>[10];
dict.Clear();
dict.CopyTo(arr, 10);
});
AssertDictionaryException(delegate(IDictionary<string, string> dict)
{
KeyValuePair<string, string>[] arr = new KeyValuePair<string, string>[10];
dict["one"] = "two";
dict.CopyTo(arr, 10);
}, new string[] { "10", "end", "array" });
AssertDictionaryException(delegate(IDictionary<string, string> dict)
{
dict.Clear();
dict["one"] = "two";
dict["two"] = "three";
dict["three"] = "four";
dict["four"] = "five";
KeyValuePair<string, string>[] arr = new KeyValuePair<string, string>[10];
dict.CopyTo(arr, 7);
}, new string[] { "10", "7", "end", "array", "4" });
}