Lines Matching refs:map
52 var map = new MapField<string, ForeignMessage> { { "x", message } }; in Clone_ClonesMessages()
53 var clone = map.Clone(); in Clone_ClonesMessages()
54 map["x"].C = 30; in Clone_ClonesMessages()
68 var map = new MapField<int, T>(); in TestNullValues()
70 Assert.Throws<ArgumentNullException>(() => map.Add(0, nullValue)); in TestNullValues()
71 Assert.Throws<ArgumentNullException>(() => map[0] = nullValue); in TestNullValues()
72 map.Add(1, nonNullValue); in TestNullValues()
73 map[1] = nonNullValue; in TestNullValues()
79 var map = new MapField<string, ForeignMessage>(); in Add_ForbidsNullKeys()
80 Assert.Throws<ArgumentNullException>(() => map.Add(null, new ForeignMessage())); in Add_ForbidsNullKeys()
86 var map = new MapField<string, ForeignMessage>(); in Indexer_ForbidsNullKeys()
87 Assert.Throws<ArgumentNullException>(() => map[null] = new ForeignMessage()); in Indexer_ForbidsNullKeys()
93 var map = new MapField<string, string>(); in AddPreservesInsertionOrder()
94 map.Add("a", "v1"); in AddPreservesInsertionOrder()
95 map.Add("b", "v2"); in AddPreservesInsertionOrder()
96 map.Add("c", "v3"); in AddPreservesInsertionOrder()
97 map.Remove("b"); in AddPreservesInsertionOrder()
98 map.Add("d", "v4"); in AddPreservesInsertionOrder()
99 CollectionAssert.AreEqual(new[] { "a", "c", "d" }, map.Keys); in AddPreservesInsertionOrder()
100 CollectionAssert.AreEqual(new[] { "v1", "v3", "v4" }, map.Values); in AddPreservesInsertionOrder()
134 var map = new MapField<string, string>(); in Equality_Simple()
135 EqualityTester.AssertEquality(map, map); in Equality_Simple()
136 EqualityTester.AssertInequality(map, null); in Equality_Simple()
137 Assert.IsFalse(map.Equals(new object())); in Equality_Simple()
185 var map = new MapField<string, string>(); in Add_KeyAlreadyExists()
186 map.Add("foo", "bar"); in Add_KeyAlreadyExists()
187 Assert.Throws<ArgumentException>(() => map.Add("foo", "baz")); in Add_KeyAlreadyExists()
193 var map = new MapField<string, string>(); in Add_Pair()
194 ICollection<KeyValuePair<string, string>> collection = map; in Add_Pair()
196 Assert.AreEqual("y", map["x"]); in Add_Pair()
203 var map = new MapField<string, string> { { "x", "y" } }; in Contains_Pair()
204 ICollection<KeyValuePair<string, string>> collection = map; in Contains_Pair()
213 var map = new MapField<string, string>(); in Remove_Key()
214 map.Add("foo", "bar"); in Remove_Key()
215 Assert.AreEqual(1, map.Count); in Remove_Key()
216 Assert.IsFalse(map.Remove("missing")); in Remove_Key()
217 Assert.AreEqual(1, map.Count); in Remove_Key()
218 Assert.IsTrue(map.Remove("foo")); in Remove_Key()
219 Assert.AreEqual(0, map.Count); in Remove_Key()
220 Assert.Throws<ArgumentNullException>(() => map.Remove(null)); in Remove_Key()
226 var map = new MapField<string, string>(); in Remove_Pair()
227 map.Add("foo", "bar"); in Remove_Pair()
228 ICollection<KeyValuePair<string, string>> collection = map; in Remove_Pair()
229 Assert.AreEqual(1, map.Count); in Remove_Pair()
231 Assert.AreEqual(1, map.Count); in Remove_Pair()
233 Assert.AreEqual(1, map.Count); in Remove_Pair()
235 Assert.AreEqual(0, map.Count); in Remove_Pair()
242 var map = new MapField<string, string>(); in CopyTo_Pair()
243 map.Add("foo", "bar"); in CopyTo_Pair()
244 ICollection<KeyValuePair<string, string>> collection = map; in CopyTo_Pair()
253 var map = new MapField<string, string> { { "x", "y" } }; in Clear()
254 Assert.AreEqual(1, map.Count); in Clear()
255 map.Clear(); in Clear()
256 Assert.AreEqual(0, map.Count); in Clear()
257 map.Add("x", "y"); in Clear()
258 Assert.AreEqual(1, map.Count); in Clear()
264 var map = new MapField<string, string> { { "x", "y" } }; in Indexer_Get()
265 Assert.AreEqual("y", map["x"]); in Indexer_Get()
266 Assert.Throws<KeyNotFoundException>(() => { var ignored = map["z"]; }); in Indexer_Get()
272 var map = new MapField<string, string>(); in Indexer_Set()
273 map["x"] = "y"; in Indexer_Set()
274 Assert.AreEqual("y", map["x"]); in Indexer_Set()
275 map["x"] = "z"; // This won't throw, unlike Add. in Indexer_Set()
276 Assert.AreEqual("z", map["x"]); in Indexer_Set()
282 IEnumerable map = new MapField<string, string> { { "x", "y" } }; in GetEnumerator_NonGeneric()
284 map.Cast<object>().ToList()); in GetEnumerator_NonGeneric()
291 IDictionary map = new MapField<string, string> { { "x", "y" } }; in IDictionary_GetEnumerator()
292 var enumerator = map.GetEnumerator(); in IDictionary_GetEnumerator()
314 var map = new MapField<string, string> { { "x", "y" } }; in IDictionary_Add()
315 IDictionary dictionary = map; in IDictionary_Add()
317 Assert.AreEqual("b", map["a"]); in IDictionary_Add()
326 var map = new MapField<string, string> { { "x", "y" } }; in IDictionary_Contains()
327 IDictionary dictionary = map; in IDictionary_Contains()
339 var map = new MapField<string, string> { { "x", "y" } }; in IDictionary_Remove()
340 IDictionary dictionary = map; in IDictionary_Remove()
355 var map = new MapField<string, string> { { "x", "y" } }; in IDictionary_CopyTo()
356 IDictionary dictionary = map; in IDictionary_CopyTo()
370 var map = new MapField<string, string> { { "x", "y" } }; in IDictionary_IsFixedSize()
371 IDictionary dictionary = map; in IDictionary_IsFixedSize()
416 var map = new MapField<string, string> { { "x", "y" } }; in IDictionary_Indexer_Set()
417 IDictionary dictionary = map; in IDictionary_Indexer_Set()
418 map["a"] = "b"; in IDictionary_Indexer_Set()
419 Assert.AreEqual("b", map["a"]); in IDictionary_Indexer_Set()
420 map["a"] = "c"; in IDictionary_Indexer_Set()
421 Assert.AreEqual("c", map["a"]); in IDictionary_Indexer_Set()
431 var map = new MapField<string, string>(); in KeysReturnsLiveView()
432 var keys = map.Keys; in KeysReturnsLiveView()
434 map["foo"] = "bar"; in KeysReturnsLiveView()
435 map["x"] = "y"; in KeysReturnsLiveView()
442 var map = new MapField<string, string>(); in ValuesReturnsLiveView()
443 var values = map.Values; in ValuesReturnsLiveView()
445 map["foo"] = "bar"; in ValuesReturnsLiveView()
446 map["x"] = "y"; in ValuesReturnsLiveView()
454 var map = new MapField<string, string>(); in ViewsAreReadOnly()
455 var keys = map.Keys; in ViewsAreReadOnly()
466 var map = new MapField<string, string> { { "foo", "bar" }, { "x", "y" } }; in ViewCopyTo()
467 var keys = map.Keys; in ViewCopyTo()
479 IDictionary map = new MapField<string, string> { { "foo", "bar" }, { "x", "y" } }; in NonGenericViewCopyTo()
480 ICollection keys = map.Keys; in NonGenericViewCopyTo()
492 var map = new MapField<string, string> { { "foo", "bar" }, { "x", "y" } }; in KeysContains()
493 var keys = map.Keys; in KeysContains()
504 var map = new MapField<string, string> { { "foo", "bar" }, { "x", "y" } }; in KeysCopyTo()
505 var keys = map.Keys.ToArray(); // Uses CopyTo internally in KeysCopyTo()
512 var map = new MapField<string, string> { { "foo", "bar" }, { "x", "y" } }; in ValuesContains()
513 var values = map.Values; in ValuesContains()
524 var map = new MapField<string, string> { { "foo", "bar" }, { "x", "y" } }; in ValuesCopyTo()
525 var values = map.Values.ToArray(); // Uses CopyTo internally in ValuesCopyTo()
532 var map = new MapField<string, string> { { "foo", "bar" }, { "x", "y" } }; in ToString_StringToString()
533 Assert.AreEqual("{ \"foo\": \"bar\", \"x\": \"y\" }", map.ToString()); in ToString_StringToString()
539 var map = new MapField<byte, string> { { 10, "foo" } }; in ToString_UnsupportedKeyType()
540 Assert.Throws<ArgumentException>(() => map.ToString()); in ToString_UnsupportedKeyType()
575 var map = new MapField<double, string> in NaNKeysComparedBitwise()
580 Assert.AreEqual("x", map[SampleNaNs.Regular]); in NaNKeysComparedBitwise()
581 Assert.AreEqual("y", map[SampleNaNs.SignallingFlipped]); in NaNKeysComparedBitwise()
583 Assert.False(map.TryGetValue(SampleNaNs.PayloadFlipped, out ignored)); in NaNKeysComparedBitwise()
590 var map = new MapField<string, string> { { "foo", "bar" }, { "x", "y" } }; in IDictionaryKeys_Equals_IReadOnlyDictionaryKeys()
591 …ssert.AreEquivalent(((IDictionary<string, string>)map).Keys, ((IReadOnlyDictionary<string, string>… in IDictionaryKeys_Equals_IReadOnlyDictionaryKeys()
597 var map = new MapField<string, string> { { "foo", "bar" }, { "x", "y" } }; in IDictionaryValues_Equals_IReadOnlyDictionaryValues()
598 …sert.AreEquivalent(((IDictionary<string, string>)map).Values, ((IReadOnlyDictionary<string, string… in IDictionaryValues_Equals_IReadOnlyDictionaryValues()