New test.
[mono.git] / mcs / tests / test-275.cs
1 using System;
2 using System.Reflection;
3 using System.Runtime.CompilerServices;
4
5 public delegate void DelType ();
6
7 struct S
8 {
9         public event DelType MyEvent;
10 }
11
12 public class Test
13 {
14         public event DelType MyEvent;
15
16         public static int Main ()
17         {
18                 EventInfo ei = typeof (Test).GetEvent ("MyEvent");
19                 MethodImplAttributes methodImplAttributes = ei.GetAddMethod ().GetMethodImplementationFlags ();
20
21                 if ((methodImplAttributes & MethodImplAttributes.Synchronized) == 0) {
22                         Console.WriteLine ("FAILED");
23                         return 1;
24                 }
25
26                 methodImplAttributes = ei.GetRemoveMethod ().GetMethodImplementationFlags ();
27                 if ((methodImplAttributes & MethodImplAttributes.Synchronized) == 0) {
28                         Console.WriteLine ("FAILED");
29                         return 2;
30                 }
31
32                 ei = typeof (S).GetEvent ("MyEvent");
33                 methodImplAttributes = ei.GetAddMethod ().GetMethodImplementationFlags ();
34
35                 if ((methodImplAttributes & MethodImplAttributes.Synchronized) != 0) {
36                         Console.WriteLine ("FAILED");
37                         return 3;
38                 }
39
40                 methodImplAttributes = ei.GetRemoveMethod ().GetMethodImplementationFlags ();
41                 if ((methodImplAttributes & MethodImplAttributes.Synchronized) != 0) {
42                         Console.WriteLine ("FAILED");
43                         return 4;
44                 }
45
46                 return 0;
47         }
48 }