本文整理汇总了C#中IApi.authorize方法的典型用法代码示例。如果您正苦于以下问题:C# IApi.authorize方法的具体用法?C# IApi.authorize怎么用?C# IApi.authorize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IApi
的用法示例。
在下文中一共展示了IApi.authorize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestAuthorizeResponseUsageReport
public void TestAuthorizeResponseUsageReport()
{
m_api = new Api(host, provider_key);
Hashtable parameters = new Hashtable();
parameters.Add("app_key", app_key);
parameters.Add("app_id", app_id);
var response = m_api.authorize(parameters);
var metric = ((UsageItem)response.usages[0]).metric;
Assert.AreEqual("hits", metric);
}
示例2: TestAuthorizeResponsePlan
public void TestAuthorizeResponsePlan()
{
m_api = new Api(host, provider_key);
Hashtable parameters = new Hashtable();
parameters.Add("app_key", app_key);
parameters.Add("app_id", app_id);
var resp = m_api.authorize(parameters);
Assert.AreEqual("Basic", resp.plan);
}
示例3: TestAuthorizeWithInvalidProviderKey
public void TestAuthorizeWithInvalidProviderKey()
{
m_api = new Api(host, invalid_provider_key);
Hashtable parameters = new Hashtable();
parameters.Add("app_key", "InvalidAppKey");
parameters.Add("app_id", "InvalidAppId");
var ex = Assert.Throws<ApiException>(() => m_api.authorize(parameters) );
Assert.That(ex.Message, Is.EqualTo("provider_key_invalid : provider key \"" + invalid_provider_key + "\" is invalid"));
}
示例4: TestAuthorizeWithInvalidAppId
public void TestAuthorizeWithInvalidAppId()
{
m_api = new Api(host, provider_key);
Hashtable parameters = new Hashtable();
parameters.Add("app_key", "1a2b3c4d5e6f7a8b9c");
parameters.Add("app_id", invalid_app_id);
var ex = Assert.Throws<ApiException>( () => m_api.authorize(parameters));
Assert.That(ex.Message, Is.EqualTo("application_not_found : application with id=\"" + invalid_app_id + "\" was not found"));
}
示例5: TestAuthorizeWithValidCredentials
public void TestAuthorizeWithValidCredentials()
{
m_api = new Api(host, provider_key);
Hashtable parameters = new Hashtable();
parameters.Add("app_key", app_key);
parameters.Add("app_id", app_id);
var response = m_api.authorize(parameters);
Assert.IsTrue(response.authorized);
}