public PropertyAccessor(PropertyInfo propertyInfo) : base(propertyInfo) { _hasSetter = (propertyInfo.GetSetMethod(true) != null); if (_hasSetter) _lateBoundPropertySet = DelegateFactory.CreateSet(propertyInfo); }
public PropertyAccessor(PropertyInfo propertyInfo) : base(propertyInfo) { _hasSetter = propertyInfo.GetSetMethod(true) != null; if (_hasSetter) { _lateBoundPropertySet = DelegateFactory.CreateSet(propertyInfo); } }
public void Should_set_property_when_property_is_a_value_type_and_type_is_interface() { var sourceType = typeof(ISource); PropertyInfo property = sourceType.GetProperty("Value"); LateBoundPropertySet callback = DelegateFactory.CreateSet(property); var source = new Source(); callback(source, 5); source.Value.ShouldEqual(5); }
public void Should_set_property_when_property_is_a_reference_type() { var sourceType = typeof(Source); PropertyInfo property = sourceType.GetProperty("Value4"); LateBoundPropertySet callback = DelegateFactory.CreateSet(property); var source = new Source(); callback(source, "hello"); source.Value4.ShouldEqual("hello"); }