Exemplo n.º 1
0
        public void a_queue_with_no_time_restriction_can_receive_messages_after_any_delay()
        {
            messaging.CreateDestination <IMsg>("Test_Destination_unbound", Expires.Never);
            messaging.SendMessage(testMessage);

            Thread.Sleep(1000); // 'huge' delay

            var message = messaging.TryStartMessage <IMsg>("Test_Destination_unbound");

            Assert.That(message, Is.Not.Null);
            message.Finish();
        }
        public void sending_a_message_without_giving_a_correlation_id_sets_a_new_guid()
        {
            messaging.CreateDestination <IMsg>("Test_Destination", Expires.Never);
            messaging.SendMessage(testMessage);
            messaging.SendMessage(testMessage);

            var message1 = messaging.TryStartMessage <IMsg>("Test_Destination");

            Assert.That(message1, Is.Not.Null, "did not get message 1");
            Assert.That(message1.Properties.CorrelationId, Is.Not.Null, "message 1 had an empty correlation id");

            var message2 = messaging.TryStartMessage <IMsg>("Test_Destination");

            Assert.That(message2, Is.Not.Null, "did not get message 2");
            Assert.That(message2.Properties.CorrelationId, Is.Not.Null, "message 2 had an empty correlation id");


            Assert.That(message2.Properties.CorrelationId, Is.Not.EqualTo(message1.Properties.CorrelationId),
                        "messages had the same correlation ID");

            message1.Finish();
            message2.Finish();
        }
        public void type_headers_survive_a_send_and_receive_round_trip()
        {
            messaging.CreateDestination <IMsg>("Test_Destination", Expires.Never);
            messaging.SendMessage(testMessage);

            var message = messaging.TryStartMessage <IMsg>("Test_Destination");

            Assert.That(message, Is.Not.Null);
            Console.WriteLine(message.Properties.OriginalType);
            Assert.That(message.Properties.OriginalType, Is.EqualTo(
                            "Example.Types.IMetadataFile;" +
                            "Example.Types.IFile;" +
                            "Example.Types.IHash;" +
                            "Example.Types.IPath;" +
                            "Example.Types.IMsg"));
        }
 public void Should_get_message_string_from_endpoint()
 {
     messaging.TryStartMessage <IMetadataFile>("MyServiceDestination");
     messageRouter.Received().Get("MyServiceDestination", out _);
 }