コード例 #1
0
ファイル: ExtensionHelpersTest.cs プロジェクト: daszat/zetbox
 public void GetPropertyValue_InvalidPropertyName()
 {
     var test = new TestClass() { BoolProperty = true, IntProperty = 42, StringProperty = "muh" };
     Assert.That(() => test.GetPropertyValue<int>("TestProperty"), Throws.InstanceOf<ArgumentOutOfRangeException>());
 }
コード例 #2
0
ファイル: ExtensionHelpersTest.cs プロジェクト: daszat/zetbox
 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>());
 }