views:

73

answers:

1

I have a Nunit test which adds message into MSMQ. In the teardown of the NUnit i want to remove all the message from the queue. Is there a direct way to remove all the messages from the queue (some kind of refresh) ?

+2  A: 

Is there a Purge() method on your queue object that would do the trick?

Edit: Yup - seems to be: http://msdn.microsoft.com/en-us/library/ms703966%28VS.85%29.aspx

Andrew M
Thanks that solved the problem
Balaji
And the .NET method reference is here: http://msdn.microsoft.com/en-us/library/system.messaging.messagequeue.purge.aspx
Jeff Sternal