protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         _streamingClient?.Dispose();
     }
 }
示例#2
0
        public static void Disconnect()
        {
            Console.WriteLine("Disconnecting from CIAPI");
            foreach (var listener in _listeners)
            {
                _streamingClient.TearDownListener(listener);
            }

            _streamingClient.Dispose();

            _rpcClient.LogOut();
            _rpcClient.Dispose();
        }
示例#3
0
        public void ShouldThrowObjectDisposedException()
        {
            var client = this.BuildRpcClient();

            client.LogIn(Settings.RpcUserName, Settings.RpcPassword);
            IStreamingClient streamingClient = client.CreateStreamingClient();


            client.Dispose();
            streamingClient.Dispose();

            Assert.Throws(typeof(ObjectDisposedException), () => client.BeginLogIn("", "", a => { }, null), "async calls not guarded");
            Assert.Throws(typeof(ObjectDisposedException), () => client.AccountInformation.GetClientAndTradingAccount(), "sync calls not guarded");
            Assert.Throws(typeof(ObjectDisposedException), () => client.CreateStreamingClient(), "streaming client factory method not guarded");
            Assert.Throws(typeof(ObjectDisposedException), () => streamingClient.BuildDefaultPricesListener(9), "streaming client listener factory method not guarded");
        }