コード例 #1
0
        public void GetFirstOrDefaultAppIdTest()
        {
            //此测试需要使用本地缓存进行测试

            var registeredAppId = base._appId;//已经注册的AppId

            var appId = AccessTokenContainer.GetFirstOrDefaultAppId();

            Assert.AreEqual(registeredAppId, appId);

            //注册多个AppId
            for (int i = 0; i < 100; i++)
            {
                AccessTokenContainer.Register("TestAppId_" + i, "TestAppSecret");
            }

            //删除部分AppId
            var collectionList = AccessTokenContainer.GetCollectionList();

            for (int i = 10; i < 50; i++)
            {
                collectionList.Remove("TestAppId_" + i);
            }

            appId = AccessTokenContainer.GetFirstOrDefaultAppId();
            Assert.AreEqual(registeredAppId, appId);
        }