* roottypes.cs: Rename from tree.cs.
[mono.git] / mono / tests / cas / inheritance / noncas1.cs
1 using System;
2 using System.Security;
3 using System.Security.Permissions;
4 using System.Security.Principal;
5
6 [PrincipalPermission (SecurityAction.InheritanceDemand, Name="me", Role="mono hacker")]
7 class BaseInheritanceDemand {
8
9         public void Test () 
10         {
11                 Console.WriteLine ("*1* [this should NOT print]");
12         }
13 }
14
15 class InheritanceDemand : BaseInheritanceDemand {
16
17         [STAThread]
18         static int Main (string[] args)
19         {
20                 try {
21                         new InheritanceDemand ().Test ();
22                         // this makes unhandled fails in the Makefile
23                         return 0;
24                 }
25                 catch (SecurityException se) {
26                         // actually we'll get an unhandled exception unless the
27                         // user is called "me" and part of the "mono hacker" group
28                         Console.WriteLine ("*2* Unexpected SecurityException\n{0}", se);
29                         return 2;
30                 }
31                 catch (Exception e) {
32                         Console.WriteLine ("*3* Unexpected Exception\n{0}", e);
33                         return 3;
34                 }
35         }
36 }