public void can_round_trip_an_envelope_through_the_queue()
        {
            var envelope = new EnvelopeToken();
            envelope.CorrelationId = Guid.NewGuid().ToString();
            envelope.Headers["Foo"] = "Bar";
            envelope.Data = new byte[] { 1, 2, 3, 4, 5 };

            var queue = new InMemoryQueue(new Uri("memory://foo"));

            var receiver = new RecordingReceiver();
            var task = Task.Factory.StartNew(() => queue.Receive(receiver));

            queue.Enqueue(envelope);

            Wait.Until(() => receiver.Received.Any(), timeoutInMilliseconds: 2000);

            var received = receiver.Received.Single();

            received.CorrelationId.ShouldEqual(envelope.CorrelationId);
            received.ContentType.ShouldEqual(envelope.ContentType);
            received.Data.ShouldEqual(envelope.Data);
            task.SafeDispose();
        }
 public InMemoryCallback(InMemoryQueue parent, EnvelopeToken token)
 {
     _parent = parent;
     _token = token;
 }
Exemplo n.º 3
0
 public static void Remove(InMemoryQueue queue)
 {
     _queues.Remove(queue.Uri);
 }
 public InMemoryChannel(Uri address)
 {
     Address = address;
     _queue = InMemoryQueueManager.QueueFor(Address);
 }
Exemplo n.º 5
0
 public InMemoryChannel(Uri address)
 {
     Address = address;
     _queue  = InMemoryQueueManager.QueueFor(Address);
 }
 public static void Remove(InMemoryQueue queue)
 {
     _queues.Remove(queue.Uri);
 }
Exemplo n.º 7
0
 public InMemoryCallback(InMemoryQueue parent, EnvelopeToken token)
 {
     _parent = parent;
     _token  = token;
 }