public void StockCommandTest()
        {
            string command = "/stock= aapl.us";

            _output.WriteLine("command:" + command);

            _commandInterpreter.InterpretCommand(command);
            Assert.True(true);
        }
示例#2
0
        public void GetFromQueue(string queue)
        {
            _channel.QueueDeclare(queue: queue,
                                  durable: false,
                                  exclusive: false,
                                  autoDelete: false,
                                  arguments: null);

            var consumer = new EventingBasicConsumer(_channel);

            consumer.Received += (model, ea) =>
            {
                var body    = ea.Body.ToArray();
                var message = Encoding.UTF8.GetString(body);
                if (queue == "ChatBot")
                {
                    _command.InterpretCommand(message);
                }
            };
            _channel.BasicConsume(queue: queue,
                                  autoAck: true,
                                  consumer: consumer);
        }