public void Can_get_property_for_subtypes() { var properties = new DynamicPropertyProvider(); properties.Add(DynamicProperty.For <Person>("Test", p => 0)); DynamicProperty property; Assert.True(properties.TryGetProperty(typeof(Employee), "Test", out property)); }
public static IWrapper Create(object value, DynamicPropertyProvider properties) { if (object.ReferenceEquals(null, value)) { return(null); } if (value is IWrapper) { return(value as IWrapper); } else { return((IWrapper)Activator.CreateInstance( typeof(Wrapper <>).MakeGenericType(value.GetType()), value, properties )); } }