public TestCommandSender(TestBusContext context)
        {
            Context         = context;
            _replyQueueName = GenerateRandomQueueName();
            context.DeclareCommandQueue(_replyQueueName);

            new Task(() =>
            {
                var queue = context.CommandQueues[_replyQueueName];

                while (true)
                {
                    if (queue.Count <= 0)
                    {
                        Thread.Sleep(250);
                        continue;
                    }

                    var response = queue.Dequeue();

                    if (!CallbackMapper.TryRemove(response.Props.CorrelationId, out TaskCompletionSource <CommandResponseMessage> tcs))
                    {
                        return;
                    }
                    var commandResponse = response.Message;;
                    tcs.TrySetResult(commandResponse as CommandResponseMessage);
                }
            }).Start();
        }
 public TestCommandReceiver(TestBusContext context, string queueName)
 {
     QueueName = queueName;
     Context   = context;
 }
 public TestMessageReceiver(TestBusContext context, string queueName, IEnumerable <string> topicExpressions)
 {
     Context          = context;
     QueueName        = queueName;
     TopicExpressions = topicExpressions;
 }
 public TestMessageSender(TestBusContext context)
 {
     Context = context;
 }