public void TestDictionaryAdd()
{
AssertDictionaryException(delegate(IDictionary<string, string> dict)
{
dict.Add(new KeyValuePair<string, string>(null, "two"));
}, new string[] { "null", "key", "two" });
AssertDictionaryException(delegate(IDictionary<string, string> dict)
{
// ReSharper disable AssignNullToNotNullAttribute
// This is sort of the point.
dict.Add(null, "two");
// ReSharper restore AssignNullToNotNullAttribute
}, new string[] { "null", "key", "two" });
AssertDictionaryException(delegate(IDictionary<string, string> dict)
{
dict.Clear();
dict.Add(new KeyValuePair<string, string>("one", "two"));
dict.Add(new KeyValuePair<string, string>("one", "three"));
}, new string[] { "one", "two", "three" });
AssertDictionaryException(delegate(IDictionary<string, string> dict)
{
dict.Clear();
dict.Add("one", "two");
dict.Add("one", "three");
}, new string[] { "one", "two", "three" });
}