public void GetPropertyValue_InvalidPropertyName() { var test = new TestClass() { BoolProperty = true, IntProperty = 42, StringProperty = "muh" }; Assert.That(() => test.GetPropertyValue<int>("TestProperty"), Throws.InstanceOf<ArgumentOutOfRangeException>()); }
public void GetPropertyValue() { var test = new TestClass() { BoolProperty = true, IntProperty = 42, StringProperty = "muh" }; Assert.That(test.GetPropertyValue<int>("IntProperty"), Is.EqualTo(test.IntProperty)); Assert.That(test.GetPropertyValue<bool>("BoolProperty"), Is.EqualTo(test.BoolProperty)); Assert.That(test.GetPropertyValue<string>("StringProperty"), Is.EqualTo(test.StringProperty)); Assert.That(() => obj.GetPropertyValue<string>("StringProperty"), Throws.InstanceOf<NotImplementedException>()); }