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()); }
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); }
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]); } }
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); }
public void SetAppIdentity(AppIdentication appIdentity) { m_appIdentity = appIdentity; }