<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi Mark,<div><br><div><div>On 24 May 2013, at 17:02, Mark Snelling wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><font face="verdana, sans-serif">I've managed to successfully implement reading from a mocked call to </font><font face="courier new, monospace">IModel.BasicConsume()</font><font face="verdana, sans-serif"> and acknowledging with&nbsp;</font><font face="courier new, monospace">IModel.BasicAck()</font><span style="font-family: verdana, sans-serif;"> but am stuck on&nbsp;</span><font face="courier new, monospace">IModel.BasicPublish()</font><span style="font-family: verdana, sans-serif;">, in particular mocking the ack/nack mechanism with </span><font face="courier new, monospace">IModel</font><span style="font-family: verdana, sans-serif;">&nbsp;as I need to test my component in both those scenarios.</span></div><div><span style="font-family: verdana, sans-serif;"><br></span></div><div><span style="font-family: verdana, sans-serif;">How does the ack/nack mechanism work with </span><font face="courier new, monospace">IModel.WaitForConfirms()</font><span style="font-family: verdana, sans-serif;">&nbsp;and how would I go about sending an ack/nack when the publisher calls&nbsp;</span><span style="font-family: 'courier new', monospace;">IModel.BasicPublish()</span><font face="verdana, sans-serif">?</font></div><div><font face="verdana, sans-serif"><br></font></div></blockquote><div><br></div><div>It really depends on how you've mocked the model reference, but essentially the broker will send either ACK&nbsp;for one (or more, if batching) or NACK for the published messages, depending on whether or not it was willing and able to take responsibility for them. Presumably in your test cases you want to handle the situation where #WaitForConfirms() fails, in which case you should either return false (where you wish to simulate the broker issuing a NACK) or return true but also set the out parameter 'timedOut' to true to indicate that a timeout occurred.</div><div><br></div><div>Hope that makes sense.</div><div><br></div><div>Cheers,</div><div>Tim</div></div></div></body></html>