Exemplo n.º 1
0
        public void GetAppInfoAsyncTest()
        {
            var finishedCount = 0;

            {
                Task.Factory.StartNew(async() =>
                {
                    //使用AppKey测试
                    //常规AccessToken测试
                    var appKey = AccessTokenContainer.BuildingKey(_corpId, base._corpSecret);
                    var result = await AppApi.GetAppInfoAsync(appKey, 2);

                    Assert.IsNotNull(result.agentid);
                    Assert.AreEqual(result.agentid, "2");

                    Console.WriteLine("1.Ticket:" + DateTime.Now.Ticks);
                    Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(result));
                    finishedCount++;
                });

                while (finishedCount < 1)
                {
                }
            }

            {
                Task.Factory.StartNew(async() =>
                {
                    //常规AccessToken测试
                    var accessToken = AccessTokenContainer.GetToken(_corpId, base._corpSecret);
                    var result      = await AppApi.GetAppInfoAsync(accessToken, 2);

                    Assert.IsNotNull(result.agentid);
                    Assert.AreEqual(result.agentid, "2");

                    Console.WriteLine("2.Ticket:" + DateTime.Now.Ticks);
                    Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(result));
                    finishedCount++;
                });

                while (finishedCount < 2)
                {
                }
            }
        }