Exemplo n.º 1
0
        public void CanLoginAsync()
        {
            var requestFactory = new TestRequestFactory();

            var throttleScopes = new Dictionary<string, IThrottedRequestQueue>
                {
                    {"data", new ThrottedRequestQueue(TimeSpan.FromSeconds(5), 30, 10)},
                    {"trading", new ThrottedRequestQueue(TimeSpan.FromSeconds(3), 1, 10)}
                };

            var ctx = new CIAPI.Rpc.Client(new Uri(TestConfig.ApiUrl), new RequestCache(), requestFactory, throttleScopes, 3);

            requestFactory.CreateTestRequest(LoggedIn);

            ctx.BeginCreateSession( TestConfig.ApiUsername, TestConfig.ApiPassword, ar =>
            {
                var response = ctx.EndCreateSession(ar);
                Assert.IsNotNullOrEmpty(response.Session);
                EnqueueTestComplete();
            }, null);

        }