Improve test to check for toplevel namespaced delegates
[mono.git] / mcs / tests / test-91.cs
1 using System;
2 using System.Reflection;
3
4 class Test {
5
6         static protected internal void MyProtectedInternal () { }
7         static internal void MyInternal() { }
8         static public void MyPublic () { }
9         static void MyPrivate () {}
10               
11         static int Main ()
12         {
13                 Type myself = typeof (Test);
14                 BindingFlags bf = BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public;
15                 MethodAttributes mpia;
16                 MethodInfo mpi;
17
18                 //
19                 // protected internal
20                 //
21                 mpi = myself.GetMethod ("MyProtectedInternal", bf);
22                 mpia = mpi.Attributes & MethodAttributes.MemberAccessMask;
23                 if (mpia != MethodAttributes.FamORAssem)
24                         return 1;
25
26                 //
27                 // internal
28                 //
29                 mpi = myself.GetMethod ("MyInternal", bf);
30                 mpia = mpi.Attributes & MethodAttributes.MemberAccessMask;
31                 if (mpia != MethodAttributes.Assembly)
32                         return 2;
33
34                 //
35                 // public
36                 //
37                 mpi = myself.GetMethod ("MyPublic", bf);
38                 mpia = mpi.Attributes & MethodAttributes.MemberAccessMask;
39                 if (mpia != MethodAttributes.Public)
40                         return 3;
41
42                 //
43                 // private
44                 //
45                 mpi = myself.GetMethod ("MyPrivate", bf);
46                 mpia = mpi.Attributes & MethodAttributes.MemberAccessMask;
47                 if (mpia != MethodAttributes.Private)
48                         return 4;
49
50                 Console.WriteLine ("All tests pass");
51                 return 0;
52         }
53 }