示例#1
0
        public void CreatePropertySetter_Dummy_Ok()
        {
            PropertySetter setter = DelegateFactory.CreatePropertySetter(typeof(Dummy).GetProperty("Id"));
            var            dummy  = new Dummy();

            setter(dummy, "1");
            Assert.Equal(dummy.Id, 1);
        }
示例#2
0
 public ObjectCreator(Type type)
 {
     _objectActivator = DelegateFactory.CreateCtor(type);
     _setters         = type
                        .GetTypeInfo()
                        .GetProperties()
                        .ToDictionary(x => x.Name, x => DelegateFactory.CreatePropertySetter(x), StringComparer.OrdinalIgnoreCase);
 }
示例#3
0
 public void CreatePropertySetter_Null_ThrowException()
 {
     Assert.Throws(typeof(ArgumentNullException), () => DelegateFactory.CreatePropertySetter(null));
 }