public void TryGetMember_is_false_when_it_is_different_return_type() { dynamic subject = new { a = "hello" }; var pp = new DynamicPropertyProvider(subject); Assert.False(pp.TryGetProperty("a", typeof(int), out _)); }
public void Can_get_property_for_subtypes() { var properties = new DynamicPropertyProvider(); properties.Add(DynamicProperty.For<Person>("Test", p => 0)); DynamicProperty property; Assert.True(properties.TryGetProperty(typeof(Employee), "Test", out property)); }
public void TryGetMember_is_true_when_it_can_bind(dynamic subject) { var pp = new DynamicPropertyProvider(subject); object actual; Assert.True(pp.TryGetProperty("a", typeof(object), out actual)); Assert.Equal("hello", actual); }
public void TryGetMember_is_false_when_it_cannot_bind(dynamic subject) { var pp = new DynamicPropertyProvider(subject); Assert.False(pp.TryGetProperty("missing", typeof(object), out _)); }