Ejemplo n.º 1
0
        public void ChangePropertySameType()
        {
            TestClass rootValue = new TestClass("root");

            DynamicValueUtility.PropertyValue result = DynamicValueUtility.FindProperty(rootValue, "someName");
            result.ChangeProperty("nonRoot");
            Assert.AreEqual("nonRoot", rootValue.Name, "Property not changed");
        }
Ejemplo n.º 2
0
        public void ChangePropertyDifferentType()
        {
            TestClass rootValue = new TestClass("root");

            rootValue.Value = 100;
            DynamicValueUtility.PropertyValue result = DynamicValueUtility.FindProperty(rootValue, "aValue");
            result.ChangeProperty("20");
            Assert.AreEqual(20, rootValue.Value, "Property not changed");
        }
Ejemplo n.º 3
0
        public void FindPropertySingle()
        {
            TestClass rootValue = new TestClass("root");

            DynamicValueUtility.PropertyValue result = DynamicValueUtility.FindProperty(rootValue, "someName");
            Assert.IsNotNull(result, "Property not found");
            Assert.AreEqual("Name", result.Property.Name, "Property names do not match");
            Assert.AreEqual("root", result.Value, "Property values do not match");
        }
Ejemplo n.º 4
0
        public void FindPropertyMultipleWithIndex()
        {
            TestClass rootValue = new TestClass("root");

            rootValue.SubValues = new TestClass[] {
                new TestClass("child1"),
                new TestClass("child2")
            };
            DynamicValueUtility.PropertyValue result = DynamicValueUtility.FindProperty(rootValue, "sub[0].someName");
            Assert.IsNotNull(result, "Property not found");
            Assert.AreEqual("Name", result.Property.Name, "Property names do not match");
            Assert.AreEqual("child1", result.Value, "Property values do not match");
        }