2010-05-11 Rodrigo Kumpera <rkumpera@novell.com>
[mono.git] / mono / tests / delegate9.cs
blobb9c1c83738201e773deabc34cb1e233f27be0ae9
1 using System;
3 // Regression test for bug #428054
5 namespace RemotingTest
7 class Program : MarshalByRefObject
9 static int Main (string[] args)
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;
20 public string CompletedHandler ()
22 return AppDomain.CurrentDomain.FriendlyName;
26 class Client : MarshalByRefObject
28 public delegate string StringDel ();
29 public event StringDel Completed;
31 public static Client CreateInNewAppDomain ()
33 AppDomain clientDomain = AppDomain.CreateDomain ("client");
34 return (Client) clientDomain.CreateInstanceAndUnwrap (
35 typeof(Client).Assembly.FullName, typeof(Client).FullName);
38 public string Run ()
40 return Completed ();