Пример #1
0
        /// <summary>
        /// Sends request to Order Execution Server for disconnecting given order execution provider
        /// </summary>
        /// <param name="providerName">Order Execution Provider to disconnect</param>
        public void Disconnect(string providerName)
        {
            // Create a new logout message
            Logout logout = new Logout()
            {
                OrderExecutionProvider = providerName
            };

            _orderExecutionService.Logout(logout);
        }
        public void ConnectivityTestCase()
        {
            bool logonArrived  = false;
            bool logoutArrived = false;

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

            _service.Connected += delegate()
            {
                _service.Login(new Login()
                {
                    OrderExecutionProvider = TradeHubConstants.OrderExecutionProvider.Simulated
                });
                manualConnectedEvent.Set();
            };

            _service.LogonArrived +=
                delegate(string obj)
            {
                logonArrived = true;
                _service.Logout(new Logout {
                    OrderExecutionProvider = TradeHubConstants.OrderExecutionProvider.Simulated
                });
                manualLogonEvent.Set();
            };

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

            _service.StartService();

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

            Assert.AreEqual(true, logonArrived, "Logon Arrived");
            Assert.AreEqual(true, logoutArrived, "Logout Arrived");
        }