Esempio n. 1
0
        public async Task TestRouterQueueLarge()
        {
            string rules = File.ReadAllText("tests/sample-data/valid-delivery-rules.json");

            Router.LoadRules(rules);

            dynamic server = ReceiveServer.Start();

            Message m = new Message();

            m.Type = "valid-test-1";

            for (int i = 0; i < 10000; i++)
            {
                Router.QueueForDelivery(m);
            }

            while (Router.Instance.MessageQueue.Count > 0)
            {
                await Task.Delay(1000);
            }

            server.Dispose();

            return;
        }
Esempio n. 2
0
        public void TestRouter()
        {
            string rules = File.ReadAllText("tests/sample-data/valid-delivery-rules.json");

            Router.LoadRules(rules);

            dynamic server = ReceiveServer.Start();

            Message m = new Message();

            m.Type = "valid-test-1";

            bool deliveryValue = Router.Deliver(m, true);

            server.Dispose();

            Assert.IsTrue(deliveryValue);
        }
Esempio n. 3
0
        public async Task TestRouterLarge()
        {
            string rules = File.ReadAllText("tests/sample-data/valid-delivery-rules.json");

            Router.LoadRules(rules);

            dynamic server = ReceiveServer.Start();

            Message m = new Message();

            m.Type = "valid-test-1";

            for (int i = 0; i < 10000; i++)
            {
                await Router.DeliverAsync(m);
            }

            server.Dispose();

            return;
        }
Esempio n. 4
0
        public void TestRouterAsync()
        {
            string rules = File.ReadAllText("tests/sample-data/valid-delivery-rules.json");

            Router.LoadRules(rules);

            dynamic server = ReceiveServer.Start();

            Message m = new Message();

            m.Type = "valid-test-1";

            try
            {
                Router.DeliverAsync(m).Wait();
            }
            finally
            {
                server.Dispose();
            }
        }