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