2 changed files with 26 additions and 1 deletions
@ -0,0 +1,24 @@ |
|||||
|
using Avalonia.Data.Core; |
||||
|
using Xunit; |
||||
|
|
||||
|
namespace Avalonia.Base.UnitTests.Data; |
||||
|
|
||||
|
public class ReflectionClrPropertyInfoTests |
||||
|
{ |
||||
|
public class TestClass |
||||
|
{ |
||||
|
public string Test { get; set; } |
||||
|
} |
||||
|
|
||||
|
[Fact] |
||||
|
public void Can_Compile() |
||||
|
{ |
||||
|
var propertyInfo = new ReflectionClrPropertyInfo( |
||||
|
typeof(TestClass).GetProperty(nameof(TestClass.Test))!); |
||||
|
var target = new TestClass(); |
||||
|
const string result = "qwerty"; |
||||
|
propertyInfo.Set(target, result); |
||||
|
Assert.Equal(result, target.Test); |
||||
|
Assert.Equal(result, (string)propertyInfo.Get(target)); |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue