Lines Matching refs:dictionary

315             IDictionary dictionary = map;
316 dictionary.Add("a", "b");
318 Assert.Throws<ArgumentException>(() => dictionary.Add("a", "duplicate"));
319 Assert.Throws<InvalidCastException>(() => dictionary.Add(new object(), "key is bad"));
320 Assert.Throws<InvalidCastException>(() => dictionary.Add("value is bad", new object()));
327 IDictionary dictionary = map;
329 Assert.IsFalse(dictionary.Contains("a"));
330 Assert.IsFalse(dictionary.Contains(5));
332 Assert.IsFalse(dictionary.Contains(new DictionaryEntry("x", "y")));
333 Assert.IsTrue(dictionary.Contains("x"));
340 IDictionary dictionary = map;
341 dictionary.Remove("a");
342 Assert.AreEqual(1, dictionary.Count);
343 dictionary.Remove(5);
344 Assert.AreEqual(1, dictionary.Count);
345 dictionary.Remove(new DictionaryEntry("x", "y"));
346 Assert.AreEqual(1, dictionary.Count);
347 dictionary.Remove("x");
348 Assert.AreEqual(0, dictionary.Count);
349 Assert.Throws<ArgumentNullException>(() => dictionary.Remove(null));
356 IDictionary dictionary = map;
358 dictionary.CopyTo(array, 1);
362 dictionary.CopyTo(objectArray, 1);
371 IDictionary dictionary = map;
372 Assert.IsFalse(dictionary.IsFixedSize);
378 IDictionary dictionary = new MapField<string, string> { { "x", "y" } };
379 CollectionAssert.AreEqual(new[] { "x" }, dictionary.Keys);
385 IDictionary dictionary = new MapField<string, string> { { "x", "y" } };
386 CollectionAssert.AreEqual(new[] { "y" }, dictionary.Values);
392 IDictionary dictionary = new MapField<string, string> { { "x", "y" } };
393 Assert.IsFalse(dictionary.IsSynchronized);
399 IDictionary dictionary = new MapField<string, string> { { "x", "y" } };
400 Assert.AreSame(dictionary, dictionary.SyncRoot);
406 IDictionary dictionary = new MapField<string, string> { { "x", "y" } };
407 Assert.AreEqual("y", dictionary["x"]);
408 Assert.IsNull(dictionary["a"]);
409 Assert.IsNull(dictionary[5]);
410 Assert.Throws<ArgumentNullException>(() => dictionary[null].GetHashCode());
417 IDictionary dictionary = map;
422 Assert.Throws<InvalidCastException>(() => dictionary[5] = "x");
423 Assert.Throws<InvalidCastException>(() => dictionary["x"] = 5);
424 Assert.Throws<ArgumentNullException>(() => dictionary[null] = "z");
425 Assert.Throws<ArgumentNullException>(() => dictionary["x"] = null);