I am new to IBM Websphere MQ.
In our projet, I have implemented code to read messages from IBM MQ.
I have installed IBM WebSphere client and I am using references of IBM.XMS and IBM.XMS.Client.WMQ to create the connection and read the message from the queue.
XMSFactoryFactory xff = XMSFactoryFactory.GetInstance(XMSC.CT_WMQ);
IConnectionFactory cf = xff.CreateConnectionFactory();
I have set the necessary properties like HostName, Channel, Port, QueueManager.
I have created the MessageListener:
MessageListener messageListener = new MessageListener(Method to process the message);
I have assigned listener to consumer:
consumer.MessageListener = messageListener;
I am able to connect to queue manager, read the message and display that message in WPF window.
Now for above code I have to write the UnitTest.
As per my knowledge, in unittest we won't be creating connection and reading from queue so how can I mock above code so that I can pass dummy message and check that.
Aucun commentaire:
Enregistrer un commentaire