Beispiel #1
0
 public void SplitPropertyIntoPartsMultipleValuesWithKey()
 {
     DynamicValueUtility.PropertyPart[] parts = DynamicValueUtility.SplitPropertyName("Test.Part2[Key=Value].Part3");
     Assert.AreEqual(3, parts.Length, "Length differs from expected");
     CheckPart(parts[0], 0, "Test", null, null);
     CheckPart(parts[1], 1, "Part2", "Key", "Value");
     CheckPart(parts[2], 2, "Part3", null, null);
 }
Beispiel #2
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");
        }
Beispiel #3
0
        public void FindActualPropertyWithInvalidProperty()
        {
            TestClass testValue = new TestClass();

            testValue.Name = "My name";
            object property = DynamicValueUtility.FindActualProperty(testValue, "Name");

            Assert.IsNull(property, "Property found");
        }
Beispiel #4
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");
        }
Beispiel #5
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");
        }
Beispiel #6
0
        public void FindActualPropertyWithValidProperty()
        {
            TestClass testValue = new TestClass();

            testValue.Name = "My name";
            MemberInfo property = DynamicValueUtility.FindActualProperty(testValue, "someName");

            Assert.IsNotNull(property, "Property not found");
            Assert.AreEqual("Name", property.Name, "Property names do not match");
        }
Beispiel #7
0
        public void FindTypedValueWithActualValue()
        {
            TestClass testValue = new TestClass();
            TestClass subValue  = new TestClass();

            testValue.SubValues = new TestClass[] {
                subValue
            };
            object result = DynamicValueUtility.FindTypedValue(testValue.SubValues, "testInstance");

            Assert.IsNotNull(result, "Typed value not found");
            Assert.AreSame(subValue, result, "Found value does not match");
        }
Beispiel #8
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");
        }
Beispiel #9
0
        public void FindKeyedValueWithActualValue()
        {
            TestClass testValue = new TestClass();
            TestClass subValue  = new TestClass();

            subValue.Name       = "A value";
            testValue.SubValues = new TestClass[] {
                subValue
            };
            object result = DynamicValueUtility.FindKeyedValue(testValue.SubValues, "someName", "A value");

            Assert.IsNotNull(result, "Keyed value not found");
            Assert.AreSame(subValue, result, "Found value does not match");
        }
Beispiel #10
0
 public void SplitPropertyIntoPartsSingleValueWithKey()
 {
     DynamicValueUtility.PropertyPart[] parts = DynamicValueUtility.SplitPropertyName("Test[Key=Value]");
     Assert.AreEqual(1, parts.Length, "Length differs from expected");
     CheckPart(parts[0], 0, "Test", "Key", "Value");
 }
Beispiel #11
0
 public override XmlNode PreprocessParameters(NetReflectorTypeTable typeTable, XmlNode inputNode)
 {
     return(DynamicValueUtility.ConvertXmlToDynamicValues(typeTable, inputNode, "sourceControls"));
 }
Beispiel #12
0
 public virtual XmlNode PreprocessParameters(NetReflectorTypeTable typeTable, XmlNode inputNode)
 {
     return(DynamicValueUtility.ConvertXmlToDynamicValues(typeTable, inputNode));
 }