Ejemplo n.º 1
0
 private void InitializeApi()
 {
     if (_api == null || _api.ConnectionDropped)
     {
         _api = new TradingScreenApi {
             UserId        = ApiUserId,
             Password      = ApiPassword,
             Site          = ApiSite,
             PricingServer = ApiPricingServer
         };
     }
 }
Ejemplo n.º 2
0
        public void TestLogon()
        {
            var api = new TradingScreenApi {
                UserId = "malbec2_uat", Password = "******", Site = "UAT Prod B", PricingServer = "tcp://uatprod.trandingscreen.net:9901"
            };

            Assert.IsFalse(api.LoggedIn);
            Assert.IsFalse(api.LoginStarted);
            Assert.IsTrue(api.Login());
            Assert.IsFalse(api.LoginStarted);
            Assert.IsTrue(api.LoggedIn);
            Assert.IsNotNull(api.LastLoginMessage);


            Assert.AreEqual("OK", api.StartListeningForOrders(TestOrderEventHandler));
            // wait for a second in case we have orders to receive
            Thread.Sleep(1000);

            Assert.IsTrue(api.Logout());
        }
Ejemplo n.º 3
0
        public void TestLogonThreaded()
        {
            var api = new TradingScreenApi {
                UserId = "malbec2_uat", Password = "******", Site = "UAT Prod B", PricingServer = "tcp://uatprod.trandingscreen.net:9901"
            };

            Assert.IsFalse(api.LoggedIn);
            Assert.IsFalse(api.LoginStarted);
            Assert.IsTrue(api.StartLogonProcess());
            Assert.IsTrue(api.LoginStarted);
            WaitFor(LoggedIn, api, 60000);
            Assert.IsTrue(api.LoggedIn);
            Assert.IsNotNull(api.LastLoginMessage);

            // The API will state we are logged in before we receive the LoginOK status message.
            WaitFor(LoginFinished, api, 30000);
            Assert.IsFalse(api.LoginStarted);

            Assert.AreEqual("OK", api.StartListeningForOrders(TestOrderEventHandler));
            // wait for a second in case we have orders to receive
            Thread.Sleep(1000);

            Assert.IsTrue(api.Logout());
        }