public virtual void Test()
		{
			Collection4 expected = new Collection4(new object[] { "PING", true, 42 });
			MessagingTestCaseBase.MessageCollector recipient = new MessagingTestCaseBase.MessageCollector
				();
			IObjectServer server = OpenServerWith(recipient);
			try
			{
				IObjectContainer client = OpenClient("client", server);
				try
				{
					IMessageSender sender = MessageSender(client);
					SendAll(expected, sender);
				}
				finally
				{
					client.Close();
				}
			}
			finally
			{
				server.Close();
			}
			Assert.AreEqual(expected.ToString(), recipient.messages.ToString());
		}
		public virtual void TestMultiThread()
		{
			DynamicVariable variable = new DynamicVariable();
			Collection4 failures = new Collection4();
			variable.With("mine", new _IRunnable_23(this, variable, failures));
			Assert.IsNull(variable.Value);
			Assert.IsTrue(failures.IsEmpty(), failures.ToString());
		}
示例#3
0
		public static void SameContent(IEnumerator expected, IEnumerator actual)
		{
			Collection4 allExpected = new Collection4(expected);
			while (actual.MoveNext())
			{
				object current = actual.Current;
				bool removed = allExpected.Remove(current);
				if (!removed)
				{
					Unexpected(current);
				}
			}
			Assert.IsTrue(allExpected.IsEmpty(), "Still missing: " + allExpected.ToString());
		}
示例#4
0
		public virtual void TestToString()
		{
			Collection4 c = new Collection4();
			Assert.AreEqual("[]", c.ToString());
			c.Add("foo");
			Assert.AreEqual("[foo]", c.ToString());
			c.Add("bar");
			Assert.AreEqual("[foo, bar]", c.ToString());
		}
		private void AssertEntries(PersistentEntry[] expected, IEnumerator actual)
		{
			Collection4 checklist = new Collection4(actual);
			Assert.AreEqual(expected.Length, checklist.Size());
			for (int i = 0; i < expected.Length; ++i)
			{
				PersistentEntry e = expected[i];
				PersistentEntry a = EntryByUid(checklist.GetEnumerator(), e.uid);
				if (a != null)
				{
					AssertEqualEntries(e, a);
					checklist.Remove(a);
				}
			}
			Assert.IsTrue(checklist.IsEmpty(), checklist.ToString());
		}
示例#6
0
 private void AssertIterator(Hashtable4 table, object[] keys)
 {
     var iter = table.Iterator();
     var expected = new Collection4(keys);
     while (iter.MoveNext())
     {
         var entry = (IEntry4) iter.Current;
         var removedOK = expected.Remove(entry.Key());
         Assert.IsTrue(removedOK);
     }
     Assert.IsTrue(expected.IsEmpty(), expected.ToString());
 }
示例#7
0
 public static void SameContent(IEnumerator expected, IEnumerator actual)
 {
     var allExpected = new Collection4();
     while (expected.MoveNext())
     {
         allExpected.Add(expected.Current);
     }
     while (actual.MoveNext())
     {
         var current = actual.Current;
         var removed = allExpected.Remove(current);
         if (!removed)
         {
             Unexpected(current);
         }
     }
     Assert.IsTrue(allExpected.IsEmpty(), allExpected.ToString());
 }