コード例 #1
0
 private HttpClient CreateTestClientWithBatchConsumer <T>(MqQueue queue, ITestOutputHelper output, ushort size = 2)
     where T : class, IMqBatchConsumerLogic <TestMqMsg>
 {
     return(CreateTestClient(new MqBatchConsumer <TestMqMsg, T>(queue.Name, size)
     {
         BatchTimeout = TimeSpan.FromSeconds(2)
     }, output));
 }
コード例 #2
0
        private async Task PublishMessages(MqQueue queue, params string[] msgs)
        {
            foreach (var msg in msgs)
            {
                queue.Publish(new TestMqMsg {
                    Content = msg
                });
            }

            await Task.Delay(500);
        }
コード例 #3
0
ファイル: MqQueueBehavior.cs プロジェクト: mylab-tools/mq
        public void ShouldFailIfQueueNotExists()
        {
            //Arrange
            var queueName    = Guid.NewGuid().ToString("N");
            var connProvider = new DefaultMqConnectionProvider(TestMqTools.Load());
            var chProvider   = new DefaultMqChannelProvider(connProvider);
            var queue        = new MqQueue(queueName, chProvider);

            //Act
            var exists = queue.IsExists();

            //Assert
            Assert.False(exists);
        }
コード例 #4
0
 private HttpClient CreateTestClientWithSingleConsumer <T>(MqQueue queue, ITestOutputHelper output)
     where T : class, IMqConsumerLogic <TestMqMsg>
 {
     return(CreateTestClient(new MqConsumer <TestMqMsg, T>(queue.Name), output));
 }