diff options
author | Aleksey Kliger (λgeek) <akliger@gmail.com> | 2017-11-09 01:37:50 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-09 01:37:50 +0300 |
commit | a9e1c60a63ee829de3a81e49e8374573c3cbfca8 (patch) | |
tree | a35a84b8b0a2a2fd314c2879e4b7e2b51eace8b0 /mcs | |
parent | b78e9b5e98b6b44dbef3745c824e2cda32b68777 (diff) | |
parent | 69ec805ff320d42c83c38f854dc3737129165e88 (diff) |
Merge pull request #5970 from lambdageek/bug-60245
[remoting] Check for transparent proxy in ves_icall_MonoField_{Get,Set}ValueInternal
Diffstat (limited to 'mcs')
-rw-r--r-- | mcs/class/corlib/Test/System.Reflection/FieldInfoTest.cs | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/mcs/class/corlib/Test/System.Reflection/FieldInfoTest.cs b/mcs/class/corlib/Test/System.Reflection/FieldInfoTest.cs index e3ed4958882..2a73eecbacb 100644 --- a/mcs/class/corlib/Test/System.Reflection/FieldInfoTest.cs +++ b/mcs/class/corlib/Test/System.Reflection/FieldInfoTest.cs @@ -1362,6 +1362,63 @@ namespace MonoTests.System.Reflection Assert.AreEqual ("B", fields.str); } + [Test] + public void GetValueContextBoundObject () + { + var instance = new CBOTest (); + + var field1 = typeof (CBOTest).GetField ("d1"); + var d1 = field1.GetValue (instance); + Assert.AreEqual ((double)d1, 14.0, "d1"); + + var field2 = typeof (CBOTest).GetField ("d2"); + var d2 = field2.GetValue (instance); + Assert.AreEqual ((double)d2, -20, "d2"); + + var field3 = typeof (CBOTest).GetField ("s1"); + var s1 = field3.GetValue (instance); + Assert.AreEqual (s1, "abcd", "s1"); + + var field4 = typeof (CBOTest).GetField ("s2"); + var s2 = field4.GetValue (instance); + Assert.AreEqual (s2, "hijkl", "s2"); + } + + [Test] + public void SetValueContextBoundObject () + { + var instance = new CBOTest (); + + var field1 = typeof (CBOTest).GetField ("d1"); + field1.SetValue (instance, 90.3); + var d1 = field1.GetValue (instance); + Assert.AreEqual ((double)d1, 90.3, "d1"); + + var field2 = typeof (CBOTest).GetField ("d2"); + field2.SetValue (instance, 1); + var d2 = field2.GetValue (instance); + Assert.AreEqual ((double)d2, 1, "d2"); + + var field3 = typeof (CBOTest).GetField ("s1"); + field3.SetValue (instance, "//////"); + var s1 = field3.GetValue (instance); + Assert.AreEqual (s1, "//////", "s1"); + + var field4 = typeof (CBOTest).GetField ("s2"); + field4.SetValue (instance, "This is a string"); + var s2 = field4.GetValue (instance); + Assert.AreEqual (s2, "This is a string", "s2"); + + } + + class CBOTest : ContextBoundObject { + public double d1 = 14.0; + public double d2 = -20.0; + public string s1 = "abcd"; + public string s2 = "hijkl"; + } + + public IntEnum PPP; public class Foo<T> |