[xbuild] ImportCollections.TryGetImport and other fixes
[mono.git] / mono / tests / cas / linkdemand / icall4.cs
1 using System;
2 using System.Reflection;
3 using System.Security;
4
5 public class Program {
6
7         // Math.Sin is a "public" internal call for both Mono and Microsoft
8         private const string icall = "Sin";
9
10         static int TestReflectedICall ()
11         {
12                 MethodInfo mi = typeof (System.Math).GetMethod (icall);
13                 if (mi == null) {
14                         Console.WriteLine ("*3* Couldn't reflect on internalcall {0}", icall);
15                         return 3;
16                 }
17
18                 return (int) (double) mi.Invoke (null, new object [1] { 0.0 });
19         }
20
21         static int Main ()
22         {
23                 try {
24                         int result = TestReflectedICall ();
25                         Console.WriteLine ("*{0}* [Reflected]System.Math.Sin(0) == {0}", result);
26                         return result;
27                 }
28                 catch (SecurityException se) {
29                         Console.WriteLine ("*1* SecurityException\n{0}", se);
30                         return 1;
31                 }
32                 catch (Exception e) {
33                         Console.WriteLine ("*2* Unexpected exception\n{0}", e);
34                         return 2;
35                 }
36         }
37 }