public void TypeAccessorBuilder_BuildSetterFromString() { var control = new SinglePropertyObject() { Id = 1 }; var experimental = new SinglePropertyObject() { Id = 1 }; var builder = new TypeAccessorBuilder<SinglePropertyObject>(); var setter = builder.BuildSetter("Id"); control.Id = 10; setter.SetterAction(ref experimental, 10); Assert.AreEqual(control.Id, experimental.Id, "Setter should assign the given value to the property."); }
public void TypeAccessorBuilder_BuildGetter() { var control = new SinglePropertyObject() { Id = 42 }; var experimental = new SinglePropertyObject() { Id = 42 }; var type = typeof(SinglePropertyObject); var member = type.GetProperty("Id"); var builder = new TypeAccessorBuilder<SinglePropertyObject>(); var getter = builder.BuildGetter(member); var controlResult = control.Id; var experimentalResult = getter(experimental); Assert.AreEqual(controlResult, experimentalResult, "Getter should return the value assigned to the property."); }