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); }
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"); }
public void FindActualPropertyWithInvalidProperty() { TestClass testValue = new TestClass(); testValue.Name = "My name"; object property = DynamicValueUtility.FindActualProperty(testValue, "Name"); Assert.IsNull(property, "Property found"); }
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"); }
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"); }
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"); }
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"); }
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"); }
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"); }
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"); }
public override XmlNode PreprocessParameters(NetReflectorTypeTable typeTable, XmlNode inputNode) { return(DynamicValueUtility.ConvertXmlToDynamicValues(typeTable, inputNode, "sourceControls")); }
public virtual XmlNode PreprocessParameters(NetReflectorTypeTable typeTable, XmlNode inputNode) { return(DynamicValueUtility.ConvertXmlToDynamicValues(typeTable, inputNode)); }