public void GenericTypeDynamicObjectFromSubFactoryTest() { dynamic sampleObject = new DynamicModel(); sampleObject.Name = "Nu"; sampleObject.Age = 12; var v = ObjectVisitor.Dynamic.CreateForDynamicObject((DynamicModel)sampleObject); Assert.Equal("Nu", v.GetValue <string>("Name")); Assert.Equal(12, v.GetValue <int>("Age")); }
public void DirectTypeDynamicObjectTest() { dynamic sampleObject = new DynamicModel(); sampleObject.Name = "Nu"; sampleObject.Age = 12; var v = ObjectVisitor.Create(typeof(DynamicModel), (DynamicModel)sampleObject); Assert.Equal("Nu", v.GetValue <string>("Name")); Assert.Equal(12, v.GetValue <int>("Age")); }