示例#1
0
 public void Can_delete_message_from_queue()
 {
     var sqs = new InMemorySqsClient();
     sqs.CreateQueue(new SqsQueueName("bar"));
     sqs.SendMessage(new SqsQueueName("bar"), "msg body");
     var receivedMessages = sqs.ReceiveMessages(new SqsQueueName("bar"), 0.Seconds(), 10).First();
     sqs.DeleteMessage(new SqsQueueName("bar"), receivedMessages.MessageReceipt);
     var remainingMessages = sqs.ReceiveMessages(new SqsQueueName("bar"), 0.Seconds(), 10);
     Assert.IsFalse(remainingMessages.Any());
 }
示例#2
0
 public void Can_round_trip_message_through_queue()
 {
     var sqs = new InMemorySqsClient();
     var queueName = new SqsQueueName("bar");
     sqs.CreateQueue(queueName);
     sqs.SendMessage(queueName, "msg body");
     var messages = sqs.ReceiveMessages(queueName, 0.Seconds(), 10);
     Assert.AreEqual(1, messages.Count());
     var received = messages.First();
     Assert.AreEqual("msg body", received.Body);
 }
示例#3
0
 public void Can_create_and_delete_queues()
 {
     var sqs = new InMemorySqsClient();
     var queueName = new SqsQueueName("bar");
     sqs.CreateQueue(queueName);
     var queues = sqs.ListQueues(null);
     Assert.AreEqual(1, queues.Count());
     Assert.AreEqual("bar", queues.First());
     sqs.DeleteQueue(queueName);
     queues = sqs.ListQueues(null);
     Assert.IsFalse(queues.Any());
 }
示例#4
0
 public void Delete_failure_throws()
 {
     var sqs = new InMemorySqsClient();
     sqs.DeleteMessage(new SqsQueueName("non-existant"), new SqsMessageReceipt("msg receipt"));
 }
示例#5
0
 public void Sending_to_non_existent_queue_sets_exception_in_result()
 {
     var sqs = new InMemorySqsClient();
     sqs.SendMessage(new SqsQueueName("foo"), "msg body");
 }
示例#6
0
 public void Cannot_sent_a_message_to_a_non_existent_queue()
 {
     var sqs = new InMemorySqsClient();
     sqs.SendMessage(new SqsQueueName("myqueuename"), "message body");
 }
示例#7
0
 public void Receiving_from_non_existent_queue_throws()
 {
     var sqs = new InMemorySqsClient();
     sqs.ReceiveMessages(new SqsQueueName("foo"), 0.Seconds(), 10);
 }
示例#8
0
 public void Cannot_receive_a_message_to_a_non_existent_queue()
 {
     var sqs = new InMemorySqsClient();
     sqs.ReceiveMessages(new SqsQueueName("queuename"), 0.Seconds(), 10);
 }