Ejemplo n.º 1
0
        public void GetWeChatServiceWithProvider()
        {
            var service = new WeChatService();

            wechat = new WeChatWithApiLimitation(2);
            service.Setup(wechat, TimeSpan.FromSeconds(0));

            var accessToken = service.GetAccessToken("dummy_appid", "dummy_secret");
            Assert.IsTrue(accessToken.StartsWith("access_token_for_dummy_appid"));
            Assert.AreNotSame(accessToken.StartsWith("access_token_for_dummy_appid"), accessToken);

            var jsTicket = service.GetTicket("my_access_token");
            Assert.IsTrue(jsTicket.StartsWith("jsticket_my_access_token"));            
            Assert.AreNotSame(service.GetTicket("my_access_token"), jsTicket);
        }
Ejemplo n.º 2
0
        public void ApiInvokingLimitationIsSeperatedOverAppIdsAndAccessTokens()
        {
            var service = new WeChatService();

            wechat = new WeChatWithApiLimitation(1);
            service.Setup(wechat, TimeSpan.FromSeconds(0));

            service.GetAccessToken("dummy_appid", "dummy_secret");
            service.GetAccessToken("another_dummy_appid", "dummy_secret");

            service.GetTicket("my_access_token");
            service.GetTicket("another_my_access_token");
        }