-Fixed dynamic property getter type information
This commit is contained in:
@@ -175,6 +175,24 @@ namespace Newtonsoft.Json.Tests.Utilities
|
||||
JsonSerializerTest.DictionaryKey key = (JsonSerializerTest.DictionaryKey)result;
|
||||
Assert.AreEqual("First!", key.Value);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CreatePropertyGetter()
|
||||
{
|
||||
PropertyInfo namePropertyInfo = typeof(Person).GetProperty(nameof(Person.Name));
|
||||
|
||||
Assert.IsNotNull(namePropertyInfo);
|
||||
|
||||
var call = DynamicReflectionDelegateFactory.Instance.CreateGet<Person>(namePropertyInfo);
|
||||
|
||||
Person p = new Person();
|
||||
p.Name = "Name!";
|
||||
|
||||
object result = call(p);
|
||||
Assert.IsNotNull(result);
|
||||
|
||||
Assert.AreEqual("Name!", (string)result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user