Exemple #1
0
        public void TestPublishReplaceOrder()
        {
            // disable the loading of the configuration - unit tests get random assembly names
            var config = new AppConfiguration {
                BrokerUrl = Nyws802
            };
            var addin = new OrderPublisherAddin(config);

            WaitFor(Connected, addin._nmsClient, 10000);
            Assert.IsTrue(addin._nmsClient.Connected(), "Failed to connect to broker");

            var sb = CreateOrderAsString();

            var response = (string)addin.PubCancel(sb);

            Assert.IsNotNull(response, "Failed to send order");
            Assert.IsFalse(IsFailedPost(response), "Order not accepted: " + response);

            addin._nmsClient.Stop();
            WaitFor(Disconnected, addin._nmsClient, 3000);
        }
Exemple #2
0
        public void TestValidateUserOrderId()
        {
            // disable the loading of the configuration - unit tests get random assembly names
            var config = new AppConfiguration {
                BrokerUrl = Nyws802
            };
            var addin    = new OrderPublisherAddin(config);
            var response = (string)addin.Pub("UserOrderId=UT12345");

            Assert.IsTrue(response.StartsWith("#Error"), "UserOrderId is too long, but failed validation");

            response = (string)addin.Pub("UserOrderId=124 56");
            Assert.IsTrue(response.StartsWith("#Error"), "UserOrderId contains space, but failed validation");
            response = (string)addin.Pub("UserOrderId=126%89");
            Assert.IsTrue(response.StartsWith("#Error"), "UserOrderId contains %, but failed validation");

            response = (string)addin.Pub("UserOrderId=123456|orderDate=" + DateTime.Now.ToShortDateString());
            Assert.IsFalse(response.StartsWith("#Error"), "UserOrderId is valid but flagged as error: " + response);
            addin._nmsClient.Stop();
            WaitFor(Disconnected, addin._nmsClient, 3000);
            Assert.IsFalse(addin._nmsClient.Connected(), "Failed to disconnect from broker");
        }