Ejemplo n.º 1
0
        public void BasicPropertyDictionary()
        {
            PropertyDictionary <ProjectPropertyInstance> properties = new PropertyDictionary <ProjectPropertyInstance>();

            ProjectPropertyInstance p1 = GetPropertyInstance("p1", "v1");
            ProjectPropertyInstance p2 = GetPropertyInstance("p2", "v2");
            ProjectPropertyInstance p3 = GetPropertyInstance("p1", "v1");
            ProjectPropertyInstance p4 = GetPropertyInstance("p2", "v3");

            properties.Set(p1);
            properties.Set(p2);
            properties.Set(p3);
            properties.Set(p1);
            properties.Set(p4);

            Assert.Equal(2, properties.Count);
            Assert.Equal("v1", properties["p1"].EvaluatedValue);
            Assert.Equal("v3", properties["p2"].EvaluatedValue);

            Assert.True(properties.Remove("p1"));
            Assert.Null(properties["p1"]);

            Assert.False(properties.Remove("x"));

            properties.Clear();

            Assert.Empty(properties);
        }
        public void TestClear_ThrowsException()
        {
            object instance = new object();
            ICollection <KeyValuePair <string, object> > dictionary = new PropertyDictionary(instance);

            dictionary.Clear();
        }