Ejemplo n.º 1
0
        public void Can_subscribe_and_get_notification_about_new_messages()
        {
            var captureClientIntegration = new CaptureClientIntegration();

            using (var c = new ClientConnection(new IPEndPoint(IPAddress.Loopback, 8182), captureClientIntegration))
            {
                c.Connect().Wait();

                c.Send(JObject.FromObject(new ChangeSubscriptionMessage
                {
                    Queues = { "/queues/abc" },
                    Type   = ChangeSubscriptionType.Add
                })).Wait();

                WaitForSubscription();

                ravenMqServer.Queues.Enqueue(new IncomingMessage
                {
                    Queue = "/queues/abc",
                    Data  = new byte[] { 12, 3 },
                });
                captureClientIntegration.MessageArrived.WaitOne();

                Assert.True(captureClientIntegration.Msgs[0].Value <bool>("Changed"));
            }
        }
Ejemplo n.º 2
0
        public void Can_subscribe_and_get_notification_about_new_messages()
        {
            var captureClientIntegration = new CaptureClientIntegration();
            using(var c = new ClientConnection(new IPEndPoint(IPAddress.Loopback, 8182), captureClientIntegration))
            {
                c.Connect().Wait();

                c.Send(JObject.FromObject(new ChangeSubscriptionMessage
                {
                    Queues = {"/queues/abc"},
                    Type = ChangeSubscriptionType.Add
                })).Wait();

                WaitForSubscription();

                ravenMqServer.Queues.Enqueue(new IncomingMessage
                {
                    Queue = "/queues/abc",
                    Data = new byte[]{12,3},
                });
                captureClientIntegration.MessageArrived.WaitOne();

                Assert.True(captureClientIntegration.Msgs[0].Value<bool>("Changed"));
            }
        }
Ejemplo n.º 3
0
        public void Can_get_notificaton_from_server()
        {
            connection.Start();

            var clientIntegration = new CaptureClientIntegration();
            using(var clientConnection = new ClientConnection(new IPEndPoint(IPAddress.Loopback, 8181), clientIntegration))
            {
                clientConnection.Connect().Wait();

                clientIntegration.MessageArrived.WaitOne();

                Assert.Equal("{\"Pong\":\"Ping\"}", clientIntegration.Msgs[0].ToString(Formatting.None));
            }
        }
Ejemplo n.º 4
0
        public void Can_get_notificaton_from_server()
        {
            connection.Start();

            var clientIntegration = new CaptureClientIntegration();

            using (var clientConnection = new ClientConnection(new IPEndPoint(IPAddress.Loopback, 8181), clientIntegration))
            {
                clientConnection.Connect().Wait();

                clientIntegration.MessageArrived.WaitOne();

                Assert.Equal("{\"Pong\":\"Ping\"}", clientIntegration.Msgs[0].ToString(Formatting.None));
            }
        }