IC5Notice: We have upgraded developerWorks Community to the latest version of IBM Connections. For more information, read our upgrade FAQ.
Topic
  • 2 replies
  • Latest Post - ‏2013-04-29T23:45:24Z by GBaddeley
sharpeye500
sharpeye500
5 Posts

Pinned topic Mocking IBM MQ methods and classes

‏2013-04-29T16:38:50Z |

 

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
    fjb_saper
    170 Posts

    Re: Mocking IBM MQ methods and classes

    ‏2013-04-29T21:09:00Z  

    Use the real thing with a managed .net connection.

  • GBaddeley
    GBaddeley
    273 Posts

    Re: Mocking IBM MQ methods and classes

    ‏2013-04-29T23:45:24Z  

    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.