예제 #1
0
        public void CanMergeTags()
        {
            // ARRANGE
            var tags1 = new TagCollection(3);

            tags1.Add("key1", "value1");
            tags1.Add("key2", "value2");
            tags1.Add("key0", "value0");

            var tags2 = new TagCollection(3);

            tags2.Add("key3", "value3");
            tags2.Add("key2", "value2");
            tags2.Add("key4", "value4");

            tags1 = tags1.AsReadOnly();
            tags2 = tags2.AsReadOnly();

            // ACT
            tags1.Merge(tags2);

            // ASSERT
            Assert.AreEqual(5, tags1.Count);
            for (int i = 0; i < 5; i++)
            {
                Assert.AreEqual("key" + i, tags1.KeyAt(i));
                Assert.AreEqual("value" + i, tags1.ValueAt(i));
            }
        }