Lines Matching refs:dictionary

316             IDictionary dictionary = map;
317 dictionary.Add("a", "b");
319 Assert.Throws<ArgumentException>(() => dictionary.Add("a", "duplicate"));
320 Assert.Throws<InvalidCastException>(() => dictionary.Add(new object(), "key is bad"));
321 Assert.Throws<InvalidCastException>(() => dictionary.Add("value is bad", new object()));
328 IDictionary dictionary = map;
330 Assert.IsFalse(dictionary.Contains("a"));
331 Assert.IsFalse(dictionary.Contains(5));
333 Assert.IsFalse(dictionary.Contains(new DictionaryEntry("x", "y")));
334 Assert.IsTrue(dictionary.Contains("x"));
341 IDictionary dictionary = map;
342 dictionary.Remove("a");
343 Assert.AreEqual(1, dictionary.Count);
344 dictionary.Remove(5);
345 Assert.AreEqual(1, dictionary.Count);
346 dictionary.Remove(new DictionaryEntry("x", "y"));
347 Assert.AreEqual(1, dictionary.Count);
348 dictionary.Remove("x");
349 Assert.AreEqual(0, dictionary.Count);
350 Assert.Throws<ArgumentNullException>(() => dictionary.Remove(null));
357 IDictionary dictionary = map;
359 dictionary.CopyTo(array, 1);
363 dictionary.CopyTo(objectArray, 1);
372 IDictionary dictionary = map;
373 Assert.IsFalse(dictionary.IsFixedSize);
379 IDictionary dictionary = new MapField<string, string> { { "x", "y" } };
380 CollectionAssert.AreEqual(new[] { "x" }, dictionary.Keys);
386 IDictionary dictionary = new MapField<string, string> { { "x", "y" } };
387 CollectionAssert.AreEqual(new[] { "y" }, dictionary.Values);
393 IDictionary dictionary = new MapField<string, string> { { "x", "y" } };
394 Assert.IsFalse(dictionary.IsSynchronized);
400 IDictionary dictionary = new MapField<string, string> { { "x", "y" } };
401 Assert.AreSame(dictionary, dictionary.SyncRoot);
407 IDictionary dictionary = new MapField<string, string> { { "x", "y" } };
408 Assert.AreEqual("y", dictionary["x"]);
409 Assert.IsNull(dictionary["a"]);
410 Assert.IsNull(dictionary[5]);
411 Assert.Throws<ArgumentNullException>(() => dictionary[null].GetHashCode());
418 IDictionary dictionary = map;
423 Assert.Throws<InvalidCastException>(() => dictionary[5] = "x");
424 Assert.Throws<InvalidCastException>(() => dictionary["x"] = 5);
425 Assert.Throws<ArgumentNullException>(() => dictionary[null] = "z");
426 Assert.Throws<ArgumentNullException>(() => dictionary["x"] = null);