diff options
Diffstat (limited to 'mono/tests/enc/ReplacePrivateVirtualMethod_v1.cs')
-rw-r--r-- | mono/tests/enc/ReplacePrivateVirtualMethod_v1.cs | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/mono/tests/enc/ReplacePrivateVirtualMethod_v1.cs b/mono/tests/enc/ReplacePrivateVirtualMethod_v1.cs new file mode 100644 index 00000000000..ed40ab374c1 --- /dev/null +++ b/mono/tests/enc/ReplacePrivateVirtualMethod_v1.cs @@ -0,0 +1,54 @@ +using System; +using System.Reflection; +using System.Runtime.CompilerServices; +using MonoEnc; + +class Container { + private Thickness _margin; + + public Thickness Margin + { + get { return _margin; } + set { _margin = value; } + } +} + +class Thickness { + public int val; + + public Thickness (int val) + { + this.val = val; + } +} + +public class Sample { + private Container listView; + + public static int Main (string []args) { + Assembly assm = typeof (Sample).Assembly; + var replacer = EncHelper.Make (); + + Sample s = new Sample (); + s.listView = new Container (); + + s.OnItemSelected (null, null); + if (s.listView.Margin.val != 30) + return 1; + + replacer.Update (assm); + + s.OnItemSelected (null, null); + if (s.listView.Margin.val != 40) + return 2; + + return 0; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + private void OnItemSelected (object sender, object s) + { + listView.Margin = new Thickness (40); + } +} + |