public void TestDictionaryRemove()
{
AssertDictionaryException(delegate(IDictionary<string, string> dict)
{
dict.Remove(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.Remove(null);
// ReSharper restore AssignNullToNotNullAttribute
}, new string[] { "null", "key" });
AssertDictionaryNoException(delegate(IDictionary<string, string> dict)
{
dict.Clear();
dict.Remove(new KeyValuePair<string, string>("blah", "two"));
});
AssertDictionaryNoException(delegate(IDictionary<string, string> dict)
{
dict.Clear();
dict.Remove("blah");
});
}