Align libgc vcxproj with makefile.
[mono.git] / mono / tests / generic-marshalbyref.2.cs
index 1576b37c99ace3efbdb06770172977e2c4788d0d..cba58400b0106571866ef25daf4aa37c2e92fe90 100644 (file)
@@ -5,8 +5,15 @@ static class Program
     static int Main()
     {
            DocumentForm<object> browseForm = new DocumentForm<object> ();
-           if (browseForm.DoInit () != 124)
+           if (browseForm.DoInit () != 248)
                    return 1;
+
+        var domain = AppDomain.CreateDomain ("foo");
+        var engine = Engine.CreateRemote (domain);
+
+        if (engine.GetDomainName<object> () != "foo")
+                       return 2;
+
            return 0;
     }
 }
@@ -24,11 +31,12 @@ class DocumentForm<T>
        internal int DoInit()
        {
                var g = new Grid1<GenEntity<T>>(123);
-               return g.num;
+               var g2 = new Grid2<GenEntity<T>>(123);
+               return g.num + g2.num;
        }
 }
 
-public class Grid1<TEntity> : MarshalByRefObject where TEntity : EntityBase, new()
+public class Grid1<TEntity> : MarshalByRefObject
 {
        public int num;
 
@@ -37,3 +45,37 @@ public class Grid1<TEntity> : MarshalByRefObject where TEntity : EntityBase, new
                num = i + 1;
        }
 }
+
+public class Grid2<TEntity> : MarshalByRefObject where TEntity : EntityBase, new()
+{
+       public int num;
+
+       public Grid2 (int i)
+       {
+               num = i + 1;
+       }
+}
+
+public class Engine : MarshalByRefObject
+{
+    public Engine ()
+    {
+    }
+
+    public string GetDomainName<T> ()
+    {
+        return AppDomain.CurrentDomain.FriendlyName;
+    }
+
+    public string GetDomainName ()
+    {
+        return AppDomain.CurrentDomain.FriendlyName;
+    }
+
+    public static Engine CreateRemote (AppDomain domain)
+    {
+        return (Engine) domain.CreateInstanceAndUnwrap (
+            typeof (Engine).Assembly.FullName,
+            typeof (Engine).FullName);
+    }
+}