Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Barker <mike@middlesoft.co.uk>2009-01-05 07:39:22 +0300
committerMichael Barker <mike@middlesoft.co.uk>2009-01-05 07:39:22 +0300
commit3777c193211cfec77bad2546697e11952f6804f9 (patch)
tree69eda4f58349da423808ed9d19a220727005f27f /mcs/class/Mono.Messaging.RabbitMQ
parent74b04d62184751483bfde3f88bcae57218bcba5e (diff)
2009-01-03 Michael Barker <mike@middlesoft.co.uk>
* AsyncPeekTest.cs: Added test for handling exceptions aysnchronously. * AsyncReceiveTest.cs: Added test for handling exceptions aysnchronously. * MessageQueueBase.cs: Added support for handling exception asynchronously. svn path=/trunk/mcs/; revision=122408
Diffstat (limited to 'mcs/class/Mono.Messaging.RabbitMQ')
-rw-r--r--mcs/class/Mono.Messaging.RabbitMQ/Test/Mono.Messaging.RabbitMQ/AsyncPeekTest.cs19
-rw-r--r--mcs/class/Mono.Messaging.RabbitMQ/Test/Mono.Messaging.RabbitMQ/AsyncReceiveTest.cs10
-rw-r--r--mcs/class/Mono.Messaging.RabbitMQ/Test/Mono.Messaging.RabbitMQ/ChangeLog5
3 files changed, 30 insertions, 4 deletions
diff --git a/mcs/class/Mono.Messaging.RabbitMQ/Test/Mono.Messaging.RabbitMQ/AsyncPeekTest.cs b/mcs/class/Mono.Messaging.RabbitMQ/Test/Mono.Messaging.RabbitMQ/AsyncPeekTest.cs
index 40cf60855fd..9663aa63ef7 100644
--- a/mcs/class/Mono.Messaging.RabbitMQ/Test/Mono.Messaging.RabbitMQ/AsyncPeekTest.cs
+++ b/mcs/class/Mono.Messaging.RabbitMQ/Test/Mono.Messaging.RabbitMQ/AsyncPeekTest.cs
@@ -62,7 +62,8 @@ namespace MonoTests.Mono.Messaging.RabbitMQ
Message rMsg = q.EndPeek (result);
Assert.AreEqual (body, rMsg.Body, "Async Send Failed, bodies not equal");
Assert.IsTrue (eventCalled, "Handle Message not called");
- q.Purge ();
+
+ Assert.IsNotNull (q.Receive (), "Message not peeked");
}
[Test]
@@ -79,7 +80,7 @@ namespace MonoTests.Mono.Messaging.RabbitMQ
Message rMsg = q.EndPeek (result);
Assert.AreEqual (body, rMsg.Body, "Async Send Failed, bodies not equal");
- q.Purge ();
+ Assert.IsNotNull (q.Receive (), "Message not peeked");
}
[Test]
@@ -97,7 +98,7 @@ namespace MonoTests.Mono.Messaging.RabbitMQ
Assert.AreEqual (body, rMsg.Body, "Async Send Failed, bodies not equal");
Assert.AreEqual ("foo", result.AsyncState, "State not passed properly");
- q.Purge ();
+ Assert.IsNotNull (q.Receive (), "Message not peeked");
}
private bool success = false;
@@ -123,7 +124,17 @@ namespace MonoTests.Mono.Messaging.RabbitMQ
Assert.AreEqual ("foo", result.AsyncState, "State not passed properly");
Assert.IsTrue (success, "Callback not run");
- q.Purge ();
+ Assert.IsNotNull (q.Receive (), "Message not peeked");
}
+
+ [Test]
+ [ExpectedException (typeof (MessageQueueException))]
+ public void BeginPeekWithException()
+ {
+ MessageQueue q = MQUtil.GetQueue (@".\private$\async-peek-5");
+ IAsyncResult result = q.BeginPeek (new TimeSpan (0, 0, 2));
+ result.AsyncWaitHandle.WaitOne ();
+ Message rMsg = q.EndPeek (result);
+ }
}
}
diff --git a/mcs/class/Mono.Messaging.RabbitMQ/Test/Mono.Messaging.RabbitMQ/AsyncReceiveTest.cs b/mcs/class/Mono.Messaging.RabbitMQ/Test/Mono.Messaging.RabbitMQ/AsyncReceiveTest.cs
index 53c3a2b50b6..e7febea3c2a 100644
--- a/mcs/class/Mono.Messaging.RabbitMQ/Test/Mono.Messaging.RabbitMQ/AsyncReceiveTest.cs
+++ b/mcs/class/Mono.Messaging.RabbitMQ/Test/Mono.Messaging.RabbitMQ/AsyncReceiveTest.cs
@@ -126,5 +126,15 @@ namespace MonoTests.Mono.Messaging.RabbitMQ
Assert.AreEqual ("foo", result.AsyncState, "State not passed properly");
Assert.IsTrue (success, "Callback not run");
}
+
+ [Test]
+ [ExpectedException (typeof (MessageQueueException))]
+ public void BeginReceiveWithException()
+ {
+ MessageQueue q = MQUtil.GetQueue (@".\private$\async-peek-5");
+ IAsyncResult result = q.BeginReceive (new TimeSpan (0, 0, 2));
+ result.AsyncWaitHandle.WaitOne ();
+ Message rMsg = q.EndReceive (result);
+ }
}
}
diff --git a/mcs/class/Mono.Messaging.RabbitMQ/Test/Mono.Messaging.RabbitMQ/ChangeLog b/mcs/class/Mono.Messaging.RabbitMQ/Test/Mono.Messaging.RabbitMQ/ChangeLog
index 289039fbbdf..c0c90ee8e15 100644
--- a/mcs/class/Mono.Messaging.RabbitMQ/Test/Mono.Messaging.RabbitMQ/ChangeLog
+++ b/mcs/class/Mono.Messaging.RabbitMQ/Test/Mono.Messaging.RabbitMQ/ChangeLog
@@ -1,3 +1,8 @@
+2009-01-03 Michael Barker <mike@middlesoft.co.uk>
+
+ * AsyncPeekTest.cs: Added test for handling exceptions aysnchronously.
+ * AsyncReceiveTest.cs: Added test for handling exceptions aysnchronously.
+
2008-12-20 Michael Barker <mike@middlesoft.co.uk>
* AsyncReceiveTest.cs: New, tests for Asynchronous Receive methods.