本文整理汇总了C#中QueueServiceClient类的典型用法代码示例。如果您正苦于以下问题:C# QueueServiceClient类的具体用法?C# QueueServiceClient怎么用?C# QueueServiceClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
QueueServiceClient类属于命名空间,在下文中一共展示了QueueServiceClient类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CreateQueue_ValidName_CreatesQueue
public void CreateQueue_ValidName_CreatesQueue()
{
IQueueServiceClient client = new QueueServiceClient(_accountSettings);
var queueName = GenerateSampleQueueName();
client.CreateQueue(queueName);
_util.AssertQueueExists(queueName);
}
开发者ID:BrianMcBrayer,项目名称:BasicAzureStorageSDK,代码行数:9,代码来源:QueueOperationsTests.cs
示例2: CreateQueue_AlreadyExistsWithNoMetadata_ReportsNoContentPerDocumentation
public void CreateQueue_AlreadyExistsWithNoMetadata_ReportsNoContentPerDocumentation()
{
IQueueServiceClient client = new QueueServiceClient(_accountSettings);
var queueName = GenerateSampleQueueName();
_util.CreateQueue(queueName);
client.CreateQueue(queueName);
// I don't think I can/should-be-able-to test the return code at this level...
}
开发者ID:BrianMcBrayer,项目名称:BasicAzureStorageSDK,代码行数:10,代码来源:QueueOperationsTests.cs
示例3: ListQueues_AtLeastOneQueue_ReturnsListContainingThatQueue
public void ListQueues_AtLeastOneQueue_ReturnsListContainingThatQueue()
{
IQueueServiceClient client = new QueueServiceClient(_accountSettings);
var queueName = GenerateSampleQueueName();
_util.CreateQueue(queueName);
var response = client.ListQueues();
Assert.IsTrue(response.Queues.Any(q => q.Name == queueName));
}
开发者ID:BrianMcBrayer,项目名称:BasicAzureStorageSDK,代码行数:10,代码来源:AccountOperationsTests.cs
示例4: PutMessage_TooLargeMessage_ThrowsRequestBodyTooLargeException
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
}
开发者ID:BrianMcBrayer,项目名称:BasicAzureStorageSDK,代码行数:11,代码来源:MessageOperationsTests.cs
示例5: CreateQueue_ValidNameAndMetadata_CreatesQueue
public void CreateQueue_ValidNameAndMetadata_CreatesQueue()
{
IQueueServiceClient client = new QueueServiceClient(_accountSettings);
var queueName = GenerateSampleQueueName();
client.CreateQueue(queueName, new Dictionary<string, string>() {
{ "SampleName", "SampleValue" }
});
_util.AssertQueueExists(queueName);
}
开发者ID:BrianMcBrayer,项目名称:BasicAzureStorageSDK,代码行数:11,代码来源:QueueOperationsTests.cs
示例6: PutMessage_ValidMessage_AddsMessageToQueue
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);
}
开发者ID:BrianMcBrayer,项目名称:BasicAzureStorageSDK,代码行数:11,代码来源:MessageOperationsTests.cs
示例7: PutMessage_InvalidXMLCharacters_DoesNotThrowException
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);
});
}
开发者ID:BrianMcBrayer,项目名称:BasicAzureStorageSDK,代码行数:12,代码来源:MessageOperationsTests.cs
示例8: CreateQueue_AlreadyExistsWithMatchingMetadata_ReportsNoContentPerDocumentation
public void CreateQueue_AlreadyExistsWithMatchingMetadata_ReportsNoContentPerDocumentation()
{
IQueueServiceClient client = new QueueServiceClient(_accountSettings);
var queueName = GenerateSampleQueueName();
_util.CreateQueue(queueName, new Dictionary<string, string> {
{ "SampleKey", "SampleValue" }
});
client.CreateQueue(queueName, new Dictionary<string, string> {
{ "SampleKey", "SampleValue" }
});
// I don't think I can/should-be-able-to test the return code at this level...
}
开发者ID:BrianMcBrayer,项目名称:BasicAzureStorageSDK,代码行数:14,代码来源:QueueOperationsTests.cs
示例9: ListQueues_MaxResultsSmallerThanQueueList_ReturnsOnlyThatManyResults
public void ListQueues_MaxResultsSmallerThanQueueList_ReturnsOnlyThatManyResults()
{
IQueueServiceClient client = new QueueServiceClient(_accountSettings);
var queueNames = new List<string>();
for (int i = 0; i < 5; i++)
{
var queueName = GenerateSampleQueueName(i.ToString());
_util.CreateQueue(queueName);
queueNames.Add(queueName);
}
var response = client.ListQueues(maxResults: 3);
Assert.AreEqual(3, response.Queues.Count);
}
开发者ID:BrianMcBrayer,项目名称:BasicAzureStorageSDK,代码行数:15,代码来源:AccountOperationsTests.cs
示例10: ListQueues_WithPrefix_ReturnsListContainingOnlyQueuesWithThatPrefix
public void ListQueues_WithPrefix_ReturnsListContainingOnlyQueuesWithThatPrefix()
{
IQueueServiceClient client = new QueueServiceClient(_accountSettings);
var queueNames = new List<string>();
for (int i = 18; i < 21; i++)
{
var queueName = GenerateSampleQueueName(i.ToString());
_util.CreateQueue(queueName);
queueNames.Add(queueName);
}
var response = client.ListQueues("1");
Assert.AreEqual("1", response.Prefix);
Assert.IsTrue(response.Queues.Count(q => q.Name.StartsWith("1")) >= 2);
Assert.AreEqual(0, response.Queues.Count(q => !q.Name.StartsWith("1")));
}
开发者ID:BrianMcBrayer,项目名称:BasicAzureStorageSDK,代码行数:17,代码来源:AccountOperationsTests.cs
示例11: 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);
});
}
开发者ID:BrianMcBrayer,项目名称:BasicAzureStorageSDK,代码行数:15,代码来源:MessageOperationsTests.cs
示例12: 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);
}
开发者ID:BrianMcBrayer,项目名称:BasicAzureStorageSDK,代码行数:17,代码来源:MessageOperationsTests.cs
示例13: 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);
}
开发者ID:BrianMcBrayer,项目名称:BasicAzureStorageSDK,代码行数:15,代码来源:MessageOperationsTests.cs
示例14: 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);
}
开发者ID:BrianMcBrayer,项目名称:BasicAzureStorageSDK,代码行数:17,代码来源:MessageOperationsTests.cs
示例15: ClearMessagesAsync_QueueDoesNotExist_ThrowsQueueNotFoundException
public async Task ClearMessagesAsync_QueueDoesNotExist_ThrowsQueueNotFoundException()
{
IQueueServiceClient client = new QueueServiceClient(_accountSettings);
var queueName = GenerateSampleQueueName();
await client.ClearMessagesAsync(queueName);
//expects exception
}
开发者ID:BrianMcBrayer,项目名称:BasicAzureStorageSDK,代码行数:9,代码来源:MessageOperationsTests.cs
示例16: PeekMessages_RequestUndefinedNumberOfItemsFromFullQueue_ReturnsOneItem
public void PeekMessages_RequestUndefinedNumberOfItemsFromFullQueue_ReturnsOneItem()
{
IQueueServiceClient client = new QueueServiceClient(_accountSettings);
var queueName = GenerateSampleQueueName();
_util.CreateQueue(queueName);
_util.AddItemsToQueue(queueName, Enumerable.Range(1, 40).Select(n => n.ToString()).ToList());
var expectedMessage = "1";
var response = client.PeekMessages(queueName);
Assert.AreEqual(1, response.Messages.Count);
var message = response.Messages.Single();
// Base 64 encode the expected message since Azure SDK did so when enqueueing it
Assert.AreEqual(Convert.ToBase64String(ASCIIEncoding.ASCII.GetBytes(expectedMessage)), message.MessageText);
}
开发者ID:BrianMcBrayer,项目名称:BasicAzureStorageSDK,代码行数:15,代码来源:MessageOperationsTests.cs
示例17: UpdateMessageAsync_NonExistentMessage_ThrowsException
public async Task UpdateMessageAsync_NonExistentMessage_ThrowsException()
{
IQueueServiceClient client = new QueueServiceClient(_accountSettings);
var queueName = GenerateSampleQueueName();
_util.CreateQueue(queueName);
await client.UpdateMessageAsync(queueName, "123-abc", FakePopReceipt, 0);
// expects exception
}
开发者ID:BrianMcBrayer,项目名称:BasicAzureStorageSDK,代码行数:10,代码来源:MessageOperationsTests.cs
示例18: GetMessages_RequestItemFromPopulatedQueue_ReturnsItemWithPopReceiptAndDequeueCount
public void GetMessages_RequestItemFromPopulatedQueue_ReturnsItemWithPopReceiptAndDequeueCount()
{
IQueueServiceClient client = new QueueServiceClient(_accountSettings);
var queueName = GenerateSampleQueueName();
_util.CreateQueue(queueName);
_util.AddItemsToQueue(queueName, new List<string>() { "1" });
var response = client.GetMessages(queueName, 1, 30);
Assert.AreEqual(1, response.Messages.Count);
var message = response.Messages.Single();
Assert.IsNotNullOrEmpty(message.PopReceipt);
Assert.Greater(message.DequeueCount, 0);
}
开发者ID:BrianMcBrayer,项目名称:BasicAzureStorageSDK,代码行数:14,代码来源:MessageOperationsTests.cs
示例19: PutMessage_ValidMessageWithVisibilityTimeout_IsNotVisibleInQueue
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);
}
开发者ID:BrianMcBrayer,项目名称:BasicAzureStorageSDK,代码行数:11,代码来源:MessageOperationsTests.cs
示例20: DeleteMessage_BadlyFormattedPopReceipt_ThrowsInvalidQueryParameterException
public void DeleteMessage_BadlyFormattedPopReceipt_ThrowsInvalidQueryParameterException()
{
IQueueServiceClient client = new QueueServiceClient(_accountSettings);
var queueName = GenerateSampleQueueName();
_util.CreateQueue(queueName);
client.DeleteMessage(queueName, "abc-123", "bad format");
// expects exception
}
开发者ID:BrianMcBrayer,项目名称:BasicAzureStorageSDK,代码行数:10,代码来源:MessageOperationsTests.cs
注:本文中的QueueServiceClient类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论