• 2 replies
  • Latest Post - ‏2013-04-29T23:45:24Z by GBaddeley
5 Posts

Pinned topic Mocking IBM MQ methods and classes

‏2013-04-29T16:38:50Z | c# ibm mq


How can i mock Get and Put methods of MQGetMessageOptions and MQPutMessageOptions  for my unit testing ? Instead of hitting the actual queue, i want to mock those. I am using MQ.NET classes.
    MQGetMessageOptions gmo = new MQGetMessageOptions();
    MQPutMessageOptions mqpmo = new MQPutMessageOptions();
Is there any way we can mock queue's import and export actions? Like calling get and put methods, but not actually sending the message to the queue, instead mock the sending action and mock the getting action.
If MQ client is not installed locally, i would like to make the unit testing methods still to work, i will be referencing amqmdnet.dll in the project. Any thoughts? Thanks. 
Updated on 2014-02-19T13:06:37Z at 2014-02-19T13:06:37Z by Morag Hughson
  • fjb_saper
    240 Posts

    Re: Mocking IBM MQ methods and classes


    Use the real thing with a managed .net connection.

  • GBaddeley
    302 Posts

    Re: Mocking IBM MQ methods and classes


    MQ Client is a free download, so why not just install it?  If you don't want to hit the actual queues, define your own dummy test queues on the MQ server.  AFAIK, there are no dummy or mockup MQ classes or methods.

    I am with fjb_saper, use the real thing.