New test.
[mono.git] / mono / tests / cas / inheritance / noncas4.cs
1 using System;
2 using System.Security;
3 using System.Security.Permissions;
4 using System.Security.Principal;
5
6 class BaseInheritanceDemand {
7
8         [PrincipalPermission (SecurityAction.InheritanceDemand, Authenticated=false)]
9         public virtual void Test () 
10         {
11                 Console.WriteLine ("*0* BaseInheritanceDemand.Test [this should print]");
12         }
13 }
14
15 class InheritanceDemand : BaseInheritanceDemand {
16
17         public override void Test () 
18         {
19                 base.Test ();
20         }
21
22         [STAThread]
23         static int Main (string[] args)
24         {
25                 try {
26                         new InheritanceDemand ().Test ();
27                         return 0;
28                 }
29                 catch (SecurityException se) {
30                         Console.WriteLine ("*1* Unexpected SecurityException\n{0}", se);
31                         return 1;
32                 }
33                 catch (Exception e) {
34                         Console.WriteLine ("*2* Unexpected Exception\n{0}", e);
35                         return 2;
36                 }
37         }
38 }