Exemple #1
0
        public void Queue_IfBoundToICollectorCloudQueueMessage_AddEnqueuesMessage()
        {
            // Arrange
            string              expectedContent = Guid.NewGuid().ToString();
            IStorageAccount     account         = CreateFakeStorageAccount();
            IStorageQueueClient client          = account.CreateQueueClient();
            IStorageQueue       triggerQueue    = CreateQueue(client, TriggerQueueName);

            triggerQueue.AddMessage(triggerQueue.CreateMessage(expectedContent));

            // Act
            RunTrigger <object>(account, typeof(BindToICollectorCloudQueueMessageProgram),
                                (s) => BindToICollectorCloudQueueMessageProgram.TaskSource = s);

            // Assert
            IStorageQueue queue = client.GetQueueReference(QueueName);
            IEnumerable <IStorageQueueMessage> messages = queue.GetMessages(messageCount: 10);

            Assert.NotNull(messages);
            Assert.Equal(1, messages.Count());
            IStorageQueueMessage message = messages.Single();

            Assert.Equal(expectedContent, message.AsString);
        }