Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mono / tests / delegate9.cs
1 using System;
2
3 // Regression test for bug #428054
4
5 namespace RemotingTest
6 {
7         class Program : MarshalByRefObject
8         {
9                 static int Main (string[] args)
10                 {
11                         Program p = new Program ();
12                         Client client = Client.CreateInNewAppDomain ();
13                         client.Completed += p.CompletedHandler;
14                         if (client.Run () != AppDomain.CurrentDomain.FriendlyName)
15                                 return 1;
16                         else
17                                 return 0;
18                 }
19
20                 public string CompletedHandler ()
21                 {
22                         return AppDomain.CurrentDomain.FriendlyName;
23                 }
24         }
25
26         class Client : MarshalByRefObject
27         {
28                 public delegate string StringDel ();
29                 public event StringDel Completed;
30
31                 public static Client CreateInNewAppDomain ()
32                 {
33                         AppDomain clientDomain = AppDomain.CreateDomain ("client");
34                         return (Client) clientDomain.CreateInstanceAndUnwrap (
35                                 typeof(Client).Assembly.FullName, typeof(Client).FullName);
36                 }
37
38                 public string Run ()
39                 {
40                         return Completed ();
41                 }
42         }
43 }