Ejemplo n.º 1
0
        public void GetAccessTokenCore()
        {
            var appid = new AppIdentication("wx7fc05579394bd02c", "26f8f072c53e97d0033e3589e7de4e84");
            var request = new AccessTokenRequest(appid);
            IApiClient client = new DefaultApiClient();
            var response = client.Execute(request);

            Console.WriteLine(response.ToString());
        }
Ejemplo n.º 2
0
        public void MatchMessageTest()
        {
            var appid = new AppIdentication("wx7fc05579394bd02c", "26f8f072c53e97d0033e3589e7de4e84");
            var request = new AccessTokenRequest(appid);
            var mock = new Mock<DefaultApiClient>();
            mock.Setup(d => d.DoExecute(request)).Returns("{\"access_token\":\"ACCESS_TOKEN\",\"expires_in\":7200}");

            var testobj = mock.Object.Execute(request);
            Console.WriteLine(testobj);
        }
Ejemplo n.º 3
0
 private ApiAccessTokenManager()
 {
     if (ConfigurationManager.AppSettings.AllKeys.Contains(s_configAppId) &&
         ConfigurationManager.AppSettings.AllKeys.Contains(s_configAppSecret))
     {
         m_appIdentity = new AppIdentication(
             ConfigurationManager.AppSettings[s_configAppId],
             ConfigurationManager.AppSettings[s_configAppSecret]);
     }
 }
Ejemplo n.º 4
0
        public void ErrorMessageTest()
        {
            var appid = new AppIdentication("wx7fc05579394bd02c", "26f8f072c53e97d0033e3589e7de4e84");
            var request = new AccessTokenRequest(appid);
            var mock = new Mock<DefaultApiClient>();
            mock.Setup(d => d.DoExecute(request)).Returns("{\"errcode\":40013,\"errmsg\":\"invalid appid\"}");

            var testobj = mock.Object.Execute(request);
            Console.WriteLine(testobj);
        }
Ejemplo n.º 5
0
 public void SetAppIdentity(AppIdentication appIdentity)
 {
     m_appIdentity = appIdentity;
 }