Add this for backwards compatibility
[mono.git] / mcs / class / System.Runtime.Remoting / Test / CallSeq.cs
index 5ab15951d0a1da1c39a72e745263e5223bbe9664..605b76087dc8fa7cdcc72f5960f5632f12de8052 100644 (file)
@@ -1,5 +1,5 @@
 //\r
-// MonoTests.System.Runtime.Remoting.CallSeq.cs\r
+// MonoTests.Remoting.CallSeq.cs\r
 //\r
 // Author: Lluis Sanchez Gual (lluis@ximian.com)\r
 //\r
@@ -11,7 +11,7 @@ using System.Threading;
 using System.Collections;\r
 using NUnit.Framework;\r
 \r
-namespace MonoTests.System.Runtime.Remoting\r
+namespace MonoTests.Remoting\r
 {\r
        public class CallSeq\r
        {\r
@@ -19,17 +19,42 @@ namespace MonoTests.System.Runtime.Remoting
                static int checkPos = 0;\r
                static int writePos = 0;\r
                static string name = "";\r
+               static ArrayList contexts = new ArrayList ();\r
+               static int domId = 1;\r
 \r
                public static void Add (string msg)\r
                {\r
                        writePos++;\r
-                       msg = writePos.ToString ("000") + " (d" + Thread.GetDomainID() + ",c" + Thread.CurrentContext.ContextID + ") " + msg;\r
+\r
+                       msg = writePos.ToString ("000") + " (d" + CommonDomainId + ",c" + CommonContextId + ") " + msg;\r
                        calls.Add (msg);\r
                }\r
 \r
+               public static int CommonContextId\r
+               {\r
+                       get\r
+                       {\r
+                               int id = Thread.CurrentContext.ContextID;\r
+                               int idc = contexts.IndexOf (id);\r
+                               if (idc == -1)\r
+                               {\r
+                                       idc = contexts.Count;\r
+                                       contexts.Add (id);\r
+                               }\r
+                               return idc;\r
+                       }\r
+               }\r
+\r
+               public static int CommonDomainId\r
+               {\r
+                       get { return domId; }\r
+                       set { domId = value; }\r
+               }\r
+\r
                public static void Init (string str)\r
                {\r
                        calls = new ArrayList();\r
+                       contexts = new ArrayList ();\r
                        name = str;\r
                        checkPos = 0;\r
                        writePos = 0;\r
@@ -48,7 +73,7 @@ namespace MonoTests.System.Runtime.Remoting
 \r
                        if (checkPos >= calls.Count)\r
                        {\r
-                               if (!optional) Assertion.Fail ("[" + name + "] Call check failed. Expected call not made: \"" + msg + "\"");\r
+                               if (!optional) Assert.Fail ("[" + name + "] Call check failed. Expected call not made: \"" + msg + "\"");\r
                                else return;\r
                        }\r
 \r
@@ -57,7 +82,7 @@ namespace MonoTests.System.Runtime.Remoting
                        if (msg.Substring (3) != call.Substring (3))\r
                        {\r
                                if (optional) checkPos--;\r
-                               else Assertion.Fail ("[" + name + "] Call check failed in step " + (checkPos+1) + ". Expected \"" + msg + "\" found \"" + call + "\"");\r
+                               else Assert.Fail ("[" + name + "] Call check failed in step " + (checkPos+1) + ". Expected \"" + msg + "\" found \"" + call + "\"");\r
                        }\r
                }\r
 \r
@@ -73,4 +98,4 @@ namespace MonoTests.System.Runtime.Remoting
                        set { calls = value; }\r
                }\r
        }\r
-}\r
+}