Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mono / tests / context-static.cs
1 using System;
2 using System.Runtime.Remoting.Contexts;
3
4 [Synchronization (SynchronizationAttribute.REQUIRES_NEW)]
5 class CBO: ContextBoundObject
6 {
7         public bool Test () {
8                 Console.WriteLine ("start value: {0}", T.var);
9                 if (T.var != 0) return true;
10                 T.var = 100;
11                 Console.WriteLine ("end value: {0}", T.var);
12                 return (T.var != 100);
13         }
14 }
15
16 class T {
17         [ContextStatic]
18         public static int var = 5;
19
20         static int Main () {
21                 bool failed = false;
22                 var = 10;
23                 
24                 CBO cbo = new CBO();
25                 failed = cbo.Test ();
26                 
27                 if (var != 10)
28                         failed = true;
29                         
30                 Console.WriteLine ("value in main context: {0}", var);
31
32                 if (failed)
33                         return 1;
34                 return 0;
35         }
36 }