2 // MonoTests.Remoting.CallSeq.cs
4 // Author: Lluis Sanchez Gual (lluis@ximian.com)
6 // 2003 (C) Copyright, Ximian, Inc.
10 using System
.Threading
;
11 using System
.Collections
;
12 using NUnit
.Framework
;
14 namespace MonoTests
.Remoting
18 static ArrayList calls
= new ArrayList();
19 static int checkPos
= 0;
20 static int writePos
= 0;
21 static string name
= "";
22 static ArrayList contexts
= new ArrayList ();
25 public static void Add (string msg
)
29 msg
= writePos
.ToString ("000") + " (d" + CommonDomainId
+ ",c" + CommonContextId
+ ") " + msg
;
33 public static int CommonContextId
37 int id
= Thread
.CurrentContext
.ContextID
;
38 int idc
= contexts
.IndexOf (id
);
48 public static int CommonDomainId
51 set { domId = value; }
54 public static void Init (string str
)
56 calls
= new ArrayList();
57 contexts
= new ArrayList ();
63 public static void Check (string msg
, int domain
)
65 bool optional
= false;
66 if (msg
.StartsWith ("#"))
69 msg
= msg
.Substring (1);
72 if (msg
[6].ToString() != domain
.ToString()) return;
74 if (checkPos
>= calls
.Count
)
76 if (!optional
) Assert
.Fail ("[" + name
+ "] Call check failed. Expected call not made: \"" + msg
+ "\"");
80 string call
= (string) calls
[checkPos
++];
82 if (msg
.Substring (3) != call
.Substring (3))
84 if (optional
) checkPos
--;
85 else Assert
.Fail ("[" + name
+ "] Call check failed in step " + (checkPos
+1) + ". Expected \"" + msg
+ "\" found \"" + call
+ "\"");
89 public static void Check (string[] msgs
, int domain
)
91 foreach (string msg
in msgs
)
95 public static ArrayList Seq
98 set { calls = value; }