public async Task ListenToQueueOverloadCalls_EventReceived_WhenEventIsReceivedForMultipleQueues() { const string queueName2 = "otherQueue"; EventReceivedCallback callbackFromBus1 = null; EventReceivedCallback callbackFromBus2 = null; SetupBusProviderMockBasicConsume( QueueName, (queue, callback, ack) => callbackFromBus1 = callback); SetupBusProviderMockBasicConsume( queueName2, (queue, callback, ack) => callbackFromBus2 = callback); var listenToQueueAndTopicStub2 = new ListenToQueueAndTopicStub <Person>(); await _sut.SetupQueueListenerAsync(QueueName, WildcardTopic, _listenToQueueAndTopicStub.GenericTypeEventListenerCallback()); await _sut.SetupQueueListenerAsync(queueName2, WildcardTopic, listenToQueueAndTopicStub2.GenericTypeEventListenerCallback()); callbackFromBus1.Invoke(EventMessage); callbackFromBus2.Invoke(EventMessage); _listenToQueueAndTopicStub.WaitHandle.WaitOne(Timeout).ShouldBeTrue(); listenToQueueAndTopicStub2.WaitHandle.WaitOne(Timeout).ShouldBeTrue(); _listenToQueueAndTopicStub.ReceivedObject.Name.ShouldBe(Person.Name); listenToQueueAndTopicStub2.ReceivedObject.Name.ShouldBe(Person.Name); }
public async Task ListenToQueueOverloadCalls_EventReceived_WhenEventIsReceivedForCorrectTopic() { EventReceivedCallback callbackFromBus = null; SetupBusProviderMockBasicConsume( QueueName, (queue, callback, ack) => callbackFromBus = callback); await _sut.SetupQueueListenerAsync(QueueName, WildcardTopic, _listenToQueueAndTopicStub.GenericTypeEventListenerCallback()); callbackFromBus.Invoke(EventMessage); _listenToQueueAndTopicStub.WaitHandle.WaitOne(Timeout).ShouldBeTrue(); _listenToQueueAndTopicStub.ReceivedObject.Name.ShouldBe(Person.Name); }