[System] Tweak socket test
[mono-project.git] / mono / tests / generic-marshalbyref.2.cs
blobcba58400b0106571866ef25daf4aa37c2e92fe90
1 using System;
3 static class Program
5 static int Main()
7 DocumentForm<object> browseForm = new DocumentForm<object> ();
8 if (browseForm.DoInit () != 248)
9 return 1;
11 var domain = AppDomain.CreateDomain ("foo");
12 var engine = Engine.CreateRemote (domain);
14 if (engine.GetDomainName<object> () != "foo")
15 return 2;
17 return 0;
21 public abstract class EntityBase
25 public class GenEntity<T> : EntityBase
29 class DocumentForm<T>
31 internal int DoInit()
33 var g = new Grid1<GenEntity<T>>(123);
34 var g2 = new Grid2<GenEntity<T>>(123);
35 return g.num + g2.num;
39 public class Grid1<TEntity> : MarshalByRefObject
41 public int num;
43 public Grid1 (int i)
45 num = i + 1;
49 public class Grid2<TEntity> : MarshalByRefObject where TEntity : EntityBase, new()
51 public int num;
53 public Grid2 (int i)
55 num = i + 1;
59 public class Engine : MarshalByRefObject
61 public Engine ()
65 public string GetDomainName<T> ()
67 return AppDomain.CurrentDomain.FriendlyName;
70 public string GetDomainName ()
72 return AppDomain.CurrentDomain.FriendlyName;
75 public static Engine CreateRemote (AppDomain domain)
77 return (Engine) domain.CreateInstanceAndUnwrap (
78 typeof (Engine).Assembly.FullName,
79 typeof (Engine).FullName);