Exemplo n.º 1
0
        public void MergingCollectionsWithNull_HasNoEffect()
        {
            var collection = new MetaDataCollection();

            collection.TryAdd("key1", "value1");

            collection.Merge(null);

            Assert.AreEqual(1, collection.Count);
            Assert.AreEqual("value1", collection["key1"]);
        }
Exemplo n.º 2
0
        public void MergingCollectionsWithSharedKeys_KeysInCollectionAreUpdated()
        {
            var collection  = new MetaDataCollection();
            var collection2 = new MetaDataCollection();

            collection.TryAdd("key1", "value1");
            collection2.TryAdd("key1", "value2");

            Assert.AreEqual("value1", collection["key1"]);

            collection.Merge(collection2);

            Assert.AreEqual(1, collection.Count);
            Assert.AreEqual("value2", collection["key1"]);
        }
Exemplo n.º 3
0
        public void MergingCollectionsWithNonSharedKeys_AllKeysIncluded()
        {
            var collection  = new MetaDataCollection();
            var collection2 = new MetaDataCollection();

            collection.TryAdd("key1", "value1");
            collection2.TryAdd("key2", "value2");

            collection.Merge(collection2);

            Assert.AreEqual(2, collection.Count);
            Assert.AreEqual("value1", collection["key1"]);
            Assert.AreEqual("value2", collection["key2"]);

            Assert.IsFalse(collection2.ContainsKey("key1"));
        }