public void SetPropertyValue_InvalidPropertyName() { var test = new TestClass() { BoolProperty = true, IntProperty = 42, StringProperty = "muh" }; Assert.That(() => test.SetPropertyValue<int>("TestProperty", 1), Throws.InstanceOf<ArgumentOutOfRangeException>()); }
public void SetPropertyValue() { var test = new TestClass(); test.SetPropertyValue<int>("IntProperty", 2); test.SetPropertyValue<bool>("BoolProperty", false); test.SetPropertyValue<string>("StringProperty", "Hello"); Assert.That(test.IntProperty, Is.EqualTo(2)); Assert.That(test.BoolProperty, Is.EqualTo(false)); Assert.That(test.StringProperty, Is.EqualTo("Hello")); }