public void ToString_PropertyConcatenatedWithSubPath() { var property = new HypnoGreen.PropertyPath.PropertyPath( new Property("Person"), new HypnoGreen.PropertyPath.PropertyPath( new ArrayItemProperty("Address", 2), new HypnoGreen.PropertyPath.PropertyPath( new Property("PostalCode")))); Assert.AreEqual("Person.Address[2].PostalCode", property.ToString()); }
public void Evaluate_PropertyIsArray_ReturnsArray() { var path = new HypnoGreen.PropertyPath.PropertyPath(new Property("Persons")); var data = new { Persons = new[] { "Michael", "Anders", "Andreas" } }; var value = path.ResolveValue(data, new ReflectionPropertyValueResolver()); Assert.AreEqual(data.Persons, value); }
public void ResolveValue_Integer_ReturnsInt() { var path = new HypnoGreen.PropertyPath.PropertyPath(new Property("Count")); var data = new { Count = 10 }; var value = path.ResolveValue <long>(data, new ReflectionPropertyValueResolver()); Assert.AreEqual(10, value); }