コード例 #1
0
        public void PutMessage_TooLargeMessage_ThrowsRequestBodyTooLargeException()
        {
            IQueueServiceClient client = new QueueServiceClient(_accountSettings);
            var queueName = GenerateSampleQueueName();
            _util.CreateQueue(queueName);
            string message = new String('a', 64 * 1024 + 1);

            client.PutMessage(queueName, message);

            //expects exception
        }
コード例 #2
0
        public void PutMessage_ValidMessage_AddsMessageToQueue()
        {
            IQueueServiceClient client = new QueueServiceClient(_accountSettings);
            var queueName = GenerateSampleQueueName();
            _util.CreateQueue(queueName);
            string message = "Unit Test Message";

            client.PutMessage(queueName, message);

            _util.AssertQueueHasMessage(queueName);
        }
コード例 #3
0
        public void PutMessage_InvalidXMLCharacters_DoesNotThrowException()
        {
            IQueueServiceClient client = new QueueServiceClient(_accountSettings);
            var queueName = GenerateSampleQueueName();
            _util.CreateQueue(queueName);
            string message = "{\"KeyValueLogPayload\": {\"UserIP\": \"::1\",\"URL\": \"http://fakeurl/foo?bar=baz&baz=bar\"}}";

            Assert.DoesNotThrow(() =>
            {
                client.PutMessage(queueName, message);
            });
        }
コード例 #4
0
        public void PutMessage_ValidMessageWithVisibilityTimeout_IsNotVisibleInQueue()
        {
            IQueueServiceClient client = new QueueServiceClient(_accountSettings);
            var queueName = GenerateSampleQueueName();
            _util.CreateQueue(queueName);
            string message = "Unit Test Message";

            client.PutMessage(queueName, message, visibilityTimeout: 5);

            _util.AssertQueueInvisibleMessage(queueName);
        }
コード例 #5
0
        public void PutMessage_ValidMessageWithTTL_DisappearsAfterTTLExpires()
        {
            IQueueServiceClient client = new QueueServiceClient(_accountSettings);
            var queueName = GenerateSampleQueueName();
            _util.CreateQueue(queueName);
            string message = "Unit Test Message";

            client.PutMessage(queueName, message, messageTtl: 1);

            _util.AssertQueueHasMessage(queueName);
            Thread.Sleep(3100); // a little extra to be sure
            _util.AssertQueueIsEmpty(queueName);
        }