Esempio n. 1
0
        public void MessageQueuedForReceive_IsNotLogged_IfReceiveAborts()
        {
            ManualResetEvent wait = new ManualResetEvent(false);

            var sender = new FakeSender
            {
                Destination = new Endpoint("localhost", 23457),
                Messages    = new[]
                {
                    new Message
                    {
                        Id =
                            new MessageId
                        {
                            MessageIdentifier = Guid.NewGuid(),
                            SourceInstanceId  = Guid.NewGuid()
                        },
                        SentAt = DateTime.Now,
                        Queue  = "h",
                        Data   = new byte[] { 1, 2, 4, 5 }
                    }
                }
            };

            sender.SendCompleted += () => wait.Set();
            var logger = new RecordingLogger();

            sender.Send();
            wait.WaitOne(TimeSpan.FromSeconds(1));
            Wait.Until(() => logger.MessagesQueuedForReceive.Any(),
                       timeoutInMilliseconds: 1000)
            .ShouldBeFalse();
        }
        public void SetupReceivedMessages()
        {
            var logger = new RecordingLogger();

            sender = ObjectMother.QueueManager(logger: logger);
            sender.Start();

            using (var tx = new TransactionScope())
            {
                sender.Send(
                    new Uri("lq.tcp://localhost:23457/h"),
                    new MessagePayload
                {
                    Data = new byte[] { 6, 7, 8, 9 }
                });

                tx.Complete();
            }

            receiver = ObjectMother.QueueManager("test2", 23457);
            receiver.CreateQueues("a");

            receiver.Start();
            sender.WaitForAllMessagesToBeSent();

            sender.Dispose();
            receiver.Dispose();

            sender   = ObjectMother.QueueManager(delete: false);
            receiver = ObjectMother.QueueManager("test2", 23457, delete: false);
            receiver.CreateQueues("a");
        }
Esempio n. 3
0
 public void Setup()
 {
     _logger = new RecordingLogger();
     _sender = ObjectMother.QueueManager();
     _sender.Start();
     _receiver = ObjectMother.QueueManager("test2", 23457, logger: _logger);
     _receiver.Start();
 }
 public void Setup()
 {
     _logger = new RecordingLogger();
     _sender = ObjectMother.QueueManager(TEST_QUEUE_1, logger:_logger);
     _sender.Start();
 }
        public void SetupReceivedMessages()
        {
            var logger = new RecordingLogger();
            sender = ObjectMother.QueueManager(logger:logger);
            sender.Start();

            using (var tx = new TransactionScope())
            {
                sender.Send(
                    new Uri("lq.tcp://localhost:23457/h"),
                    new MessagePayload
                    {
                        Data = new byte[] { 6, 7, 8, 9 }
                    });

                tx.Complete();
            }

            receiver = ObjectMother.QueueManager("test2", 23457);
            receiver.CreateQueues("a");

            receiver.Start();
            sender.WaitForAllMessagesToBeSent();

            sender.Dispose();
            receiver.Dispose();

            sender = ObjectMother.QueueManager(delete: false);
            receiver = ObjectMother.QueueManager("test2", 23457, delete:false);
            receiver.CreateQueues("a");
        }
Esempio n. 6
0
 public void Setup()
 {
     _logger = new RecordingLogger();
     _sender = ObjectMother.QueueManager(logger: _logger);
     _sender.Start();
 }
        public void MessageQueuedForReceive_EventNotRaised_IfReceiveAborts()
        {
            ManualResetEvent wait = new ManualResetEvent(false);

            var sender = new FakeSender(ObjectMother.Logger())
            {
                Destination = new Endpoint("localhost", 23457),
                Messages = new[]
                {
                    new Message
                    {
                        Id =
                            new MessageId
                            {
                                MessageIdentifier = Guid.NewGuid(),
                                SourceInstanceId = Guid.NewGuid()
                            },
                        SentAt = DateTime.Now,
                        Queue = "h",
                        Data = new byte[] {1, 2, 4, 5}
                    }
                }
            };

            sender.SendCompleted += () => wait.Set();
            var logger = new RecordingLogger();
            sender.Send();
            wait.WaitOne(TimeSpan.FromSeconds(1));
            Wait.Until(() => logger.DebugMessages.OfType<MessageQueuedForReceive>().Any(),
                timeoutInMilliseconds: 1000)
                .ShouldBeFalse();
        }
 public void Setup()
 {
     _logger = new RecordingLogger();
     _sender = ObjectMother.QueueManager();
     _sender.Start();
     _receiver = ObjectMother.QueueManager("test2", 23457, logger: _logger);
     _receiver.Start();
 }
Esempio n. 9
0
 public IntegrationTests(SharedTestDirectory testDirectory)
 {
     _senderLogger = new RecordingLogger();
     _receiver     = ObjectMother.NewQueue(testDirectory.CreateNewDirectoryForTest(), "receiver");
     _sender       = ObjectMother.NewQueue(testDirectory.CreateNewDirectoryForTest(), "sender", _senderLogger);
 }