本文整理汇总了C#中QueueServiceClient.UpdateMessage方法的典型用法代码示例。如果您正苦于以下问题:C# QueueServiceClient.UpdateMessage方法的具体用法?C# QueueServiceClient.UpdateMessage怎么用?C# QueueServiceClient.UpdateMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueueServiceClient
的用法示例。
在下文中一共展示了QueueServiceClient.UpdateMessage方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateMessage_NonExistentMessage_ThrowsException
public void UpdateMessage_NonExistentMessage_ThrowsException()
{
IQueueServiceClient client = new QueueServiceClient(_accountSettings);
var queueName = GenerateSampleQueueName();
_util.CreateQueue(queueName);
client.UpdateMessage(queueName, "123-abc", FakePopReceipt, 0);
// expects exception
}
示例2: UpdateMessage_InvalidXMLMessageTextCharacters_DoesNotThrowException
public void UpdateMessage_InvalidXMLMessageTextCharacters_DoesNotThrowException()
{
const string rawFirstText = "<QueueMessage><MessageText>Test</MessageText></QueueMessage>";
const string rawSecondText = "{\"KeyValueLogPayload\": {\"UserIP\": \"::1\",\"URL\": \"http://fakeurl/foo?bar=baz&baz=bar\"}}";
IQueueServiceClient client = new QueueServiceClient(_accountSettings);
var queueName = GenerateSampleQueueName();
_util.CreateQueue(queueName);
_util.AddItemsToQueue(queueName, new List<string>() { rawFirstText });
var itemFromQueue = _util.GetItemFromQueue(queueName, 1);
Assert.DoesNotThrow(() =>
{
client.UpdateMessage(queueName, itemFromQueue.Id, itemFromQueue.PopReceipt, 0, rawSecondText);
});
}
示例3: UpdateMessage_DifferentMessageText_ChangesMessageText
public void UpdateMessage_DifferentMessageText_ChangesMessageText()
{
const string rawFirstText = "1";
const string rawSecondText = "2";
var firstText = Convert.ToBase64String(Encoding.UTF8.GetBytes(rawFirstText));
var secondText = Convert.ToBase64String(Encoding.UTF8.GetBytes(rawSecondText));
IQueueServiceClient client = new QueueServiceClient(_accountSettings);
var queueName = GenerateSampleQueueName();
_util.CreateQueue(queueName);
_util.AddItemsToQueue(queueName, new List<string>() { firstText });
var itemFromQueue = _util.GetItemFromQueue(queueName, 1);
client.UpdateMessage(queueName, itemFromQueue.Id, itemFromQueue.PopReceipt, 0, secondText);
var itemFromQueueAgain = _util.GetItemFromQueue(queueName);
Assert.AreEqual(rawSecondText, itemFromQueueAgain.AsString);
}
示例4: UpdateMessage_ExtendVisibility_ExtendsMessageVisibilityInTheQueue
public void UpdateMessage_ExtendVisibility_ExtendsMessageVisibilityInTheQueue()
{
IQueueServiceClient client = new QueueServiceClient(_accountSettings);
var queueName = GenerateSampleQueueName();
_util.CreateQueue(queueName);
_util.AddItemsToQueue(queueName, new List<string>() { "1" });
var itemFromQueue = _util.GetItemFromQueue(queueName, 1);
var response = client.UpdateMessage(queueName, itemFromQueue.Id, itemFromQueue.PopReceipt, 30);
Assert.IsNotNullOrEmpty(response.PopReceipt);
Thread.Sleep(2000); // longer than the original visibility timeout
var itemFromQueueAgain = _util.GetItemFromQueue(queueName);
Assert.IsNull(itemFromQueueAgain);
}
示例5: UpdateMessage_UpdateContent_UpdatesContentOfMessageInQueue
public void UpdateMessage_UpdateContent_UpdatesContentOfMessageInQueue()
{
IQueueServiceClient client = new QueueServiceClient(_accountSettings);
var queueName = GenerateSampleQueueName();
_util.CreateQueue(queueName);
_util.AddItemsToQueue(queueName, new List<string>() { "1" });
var itemFromQueue = _util.GetItemFromQueue(queueName);
var newString = Convert.ToBase64String(Encoding.ASCII.GetBytes("2")); // the official SDK base 64's the values automatically
client.UpdateMessage(queueName, itemFromQueue.Id, itemFromQueue.PopReceipt, 0, newString);
var itemFromQueueAgain = _util.GetItemFromQueue(queueName);
Assert.IsNotNull(itemFromQueueAgain);
Assert.AreEqual(itemFromQueue.Id, itemFromQueueAgain.Id);
Assert.AreEqual("1", itemFromQueue.AsString);
Assert.AreEqual("2", itemFromQueueAgain.AsString);
}
示例6: UpdateMessage_ClearVisibility_AllowsMessageToBeRetrievedAgain
public void UpdateMessage_ClearVisibility_AllowsMessageToBeRetrievedAgain()
{
IQueueServiceClient client = new QueueServiceClient(_accountSettings);
var queueName = GenerateSampleQueueName();
_util.CreateQueue(queueName);
_util.AddItemsToQueue(queueName, new List<string>() { "1" });
var itemFromQueue = _util.GetItemFromQueue(queueName);
client.UpdateMessage(queueName, itemFromQueue.Id, itemFromQueue.PopReceipt, 0);
var itemFromQueueAgain = _util.GetItemFromQueue(queueName);
Assert.IsNotNull(itemFromQueueAgain);
Assert.AreEqual(itemFromQueue.Id, itemFromQueueAgain.Id);
}