Skip to content

Instantly share code, notes, and snippets.

@mxriverlynn
Created January 15, 2010 15:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mxriverlynn/278116 to your computer and use it in GitHub Desktop.
Save mxriverlynn/278116 to your computer and use it in GitHub Desktop.
public static class ServiceBusExtensions
{
public static bool HasSubscribersFor<T>(this IServiceBus serviceBus, T message)
{
IEnumerable<Action<object>> enumerable = serviceBus.OutboundPipeline.Enumerate(message);
return enumerable.Count() > 0;
}
}
private IServiceBus BuildServiceBus()
{
var serviceBus = Mock<IServiceBus>();
var messagePipeline = Mock<IMessagePipeline>();
var messageHandlers = new Action<Object>[1];
messagePipeline.Stub(m => m.Enumerate(null))
.IgnoreArguments()
.Return(messageHandlers);
serviceBus.Stub(s => s.OutboundPipeline).Return(messagePipeline);
return serviceBus;
}
class ServiceBusExtensions
def HasSubscribersFor(*args)
return true
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment