public void SaveNull() { var name = Guid.NewGuid().ToString(); var t = new StorageQueue(name, ConnectionString); Assert.That(() => t.Send((object)null), Throws.TypeOf <ArgumentNullException>()); }
static int Main(string[] args) { if (args.Length == 0) { return(-1); } string storageUrl = args[0]; var queue = new StorageQueue(storageUrl); while (true) { string message = Console.ReadLine(); if (message == null) { break; } queue.Send(message); } return(0); }
public async Task RoundTripMsgAsObj() { var storage = new StorageQueue(QueueName, ConnectionString); var msg = new CloudQueueMessage(Guid.NewGuid().ToByteArray()); await storage.Send((object)msg); var returned = await storage.Get(); Assert.AreEqual(msg.AsBytes, returned.AsBytes); }
public async Task Delete() { var storage = new StorageQueue(QueueName, ConnectionString); var msg = new CloudQueueMessage(Guid.NewGuid().ToByteArray()); await storage.Send(msg); var returned = await storage.Get(); await storage.Delete(returned); }
public async Task RoundTripObject() { var storage = new StorageQueue(QueueName, ConnectionString); var expected = Guid.NewGuid(); await storage.Send(expected); var returned = await storage.Get(); var guid = JsonConvert.DeserializeObject <Guid>(returned.AsString); Assert.AreEqual(expected, guid); }
public async Task RoundTripMsgAsObj() { StorageQueue storage = await QueueSetup(); var msg = new CloudQueueMessage(Guid.NewGuid().ToByteArray()); await storage.Send((object)msg); var returned = await storage.Get(); Assert.AreEqual(msg.AsBytes, returned.AsBytes); await storage.Delete(); }
public async Task Delete() { StorageQueue storage = await QueueSetup(); var msg = new CloudQueueMessage(Guid.NewGuid().ToByteArray()); await storage.Send(msg); var returned = await storage.Get(); await storage.Delete(returned); await storage.Delete(); }
public async Task RoundTripObject() { StorageQueue storage = await QueueSetup(); var expected = Guid.NewGuid(); await storage.Send(expected); var returned = await storage.Get(); var guid = JsonConvert.DeserializeObject <Guid>(returned.AsString); Assert.AreEqual(expected, guid); await storage.Delete(); }
public async Task ApproixmateMessageCount() { var random = new Random(); var count = random.Next(1, 1000); var storage = new StorageQueue(QueueName, ConnectionString); for (var i = 0; i < count; i++) { await storage.Send(Guid.NewGuid()); } var result = await storage.ApproixmateMessageCount(); Assert.AreEqual(count, result); }
public async Task Peek() { StorageQueue storage = await QueueSetup(); var msg = new CloudQueueMessage(Guid.NewGuid().ToByteArray()); await storage.Send(msg); var peeked = await storage.PeekAsync(); Assert.AreEqual(msg.AsBytes, peeked.First().AsBytes); var returned = await storage.Get(); Assert.AreEqual(msg.AsBytes, returned.AsBytes); await storage.Delete(); }
public async Task ApproixmateMessageCount() { var random = new Random(); var count = random.Next(1, 1000); StorageQueue storage = await QueueSetup(); for (var i = 0; i < count; i++) { await storage.Send(Guid.NewGuid()); } var result = await storage.ApproixmateMessageCount(); Assert.AreEqual(count, result); await storage.Delete(); }
public async Task GetManyNegative() { var random = new Random(); var count = random.Next(1, 25); var storage = new StorageQueue(QueueName, ConnectionString); for (var i = 0; i < count; i++) { var msg = new CloudQueueMessage(Guid.NewGuid().ToByteArray()); await storage.Send(msg); } var returned = await storage.GetMany(-1); Assert.AreEqual(1, returned.Count()); }
public async Task RoundTripMany() { var random = new Random(); var count = random.Next(1, 25); StorageQueue storage = await QueueSetup(); for (var i = 0; i < count; i++) { var msg = new CloudQueueMessage(Guid.NewGuid().ToByteArray()); await storage.Send(msg); } var returned = await storage.GetMany(count); Assert.AreEqual(count, returned.Count()); await storage.Delete(); }