Esempio n. 1
0
        public void MarketDataProviderInfoTestCase()
        {
            bool logonArrived           = false;
            bool logoutArrived          = false;
            bool inquiryResponseArrived = false;

            ManualResetEvent manualLogonEvent           = new ManualResetEvent(false);
            ManualResetEvent manualLogoutEvent          = new ManualResetEvent(false);
            ManualResetEvent manualConnectedEvent       = new ManualResetEvent(false);
            ManualResetEvent manualInquiryResponseEvent = new ManualResetEvent(false);

            _marketDataEngineClient.ServerConnected += delegate()
            {
                _marketDataEngineClient.SendLoginRequest(new Login()
                {
                    MarketDataProvider = TradeHubConstants.MarketDataProvider.Simulated
                });
                manualConnectedEvent.Set();
            };

            _marketDataEngineClient.LogonArrived +=
                delegate(string obj)
            {
                logonArrived = true;

                _marketDataEngineClient.SendInquiryRequest(TradeHubConstants.MarketDataProvider.Simulated);
                manualLogonEvent.Set();
            };

            _marketDataEngineClient.InquiryResponseArrived +=
                delegate(MarketDataProviderInfo obj)
            {
                inquiryResponseArrived = true;
                Console.WriteLine(obj);
                _marketDataEngineClient.SendLogoutRequest(new Logout {
                    MarketDataProvider = TradeHubConstants.MarketDataProvider.Simulated
                });
                manualInquiryResponseEvent.Set();
            };

            _marketDataEngineClient.LogoutArrived +=
                delegate(string obj)
            {
                logoutArrived = true;
                manualLogoutEvent.Set();
            };

            _marketDataEngineClient.Start();

            manualConnectedEvent.WaitOne(30000, false);
            manualLogonEvent.WaitOne(30000, false);
            manualInquiryResponseEvent.WaitOne(30000, false);
            manualLogoutEvent.WaitOne(30000, false);

            Assert.AreEqual(true, logonArrived, "Logon Arrived");
            Assert.AreEqual(true, inquiryResponseArrived, "Inquiry Response Arrived");
            Assert.AreEqual(true, logoutArrived, "Logout Arrived");
        }
Esempio n. 2
0
 void _marketDataEngineClient_LogonArrived(string obj)
 {
     _marketDataEngineClient.SendInquiryRequest(Common.Core.Constants.MarketDataProvider.Simulated);
 }