本文整理汇总了C#中AuthenticationService.GetAuthenticatedClient方法的典型用法代码示例。如果您正苦于以下问题:C# AuthenticationService.GetAuthenticatedClient方法的具体用法?C# AuthenticationService.GetAuthenticatedClient怎么用?C# AuthenticationService.GetAuthenticatedClient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AuthenticationService
的用法示例。
在下文中一共展示了AuthenticationService.GetAuthenticatedClient方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GivenANullIAuthenticationServiceSettings_CheckCallback_ThrowsAnException
public void GivenANullIAuthenticationServiceSettings_CheckCallback_ThrowsAnException()
{
// Arrange.
var querystringParams = new NameValueCollection {{"a", "b"}};
var authenticationService = new AuthenticationService();
// Act and Assert.
var result = Assert.Throws<ArgumentNullException>(
() => authenticationService.GetAuthenticatedClient(null, querystringParams));
Assert.NotNull(result);
Assert.Equal("Value cannot be null.\r\nParameter name: authenticationServiceSettings", result.Message);
}
示例2: GiveAMissingProviderKeyQuerystringValue_CheckCallback_ThrowsAnException
public void GiveAMissingProviderKeyQuerystringValue_CheckCallback_ThrowsAnException()
{
// Arrange.
var authenticationService = new AuthenticationService();
// Act.
var result =
Assert.Throws<ArgumentNullException>(
() => authenticationService.GetAuthenticatedClient(null, null, null));
// Assert.
Assert.NotNull(result);
Assert.Equal("Value cannot be null.\r\nParameter name: providerKey", result.Message);
}
开发者ID:codeprogression,项目名称:WorldDomination.Web.Authentication,代码行数:14,代码来源:AuthenticationServiceFacts.cs
示例3: GivenAnInvalidProviderKey_CheckCallback_ThrowsAnException
public void GivenAnInvalidProviderKey_CheckCallback_ThrowsAnException()
{
// Arrange.
const string providerKey = "aaa";
const string state = "asd";
var querystringParams = new NameValueCollection {{"a", "b"}};
var authenticationService = new AuthenticationService();
// Act and Assert.
var result = Assert.Throws<AuthenticationException>(
() => authenticationService.GetAuthenticatedClient(providerKey, querystringParams, state));
Assert.NotNull(result);
Assert.Equal("No 'aaa' provider has been added.", result.Message);
}
示例4: GivenAFakeProviderKey_GetAuthenticatedClient_ReturnsADefaultAuthenticatedClient
public void GivenAFakeProviderKey_GetAuthenticatedClient_ReturnsADefaultAuthenticatedClient()
{
// Arrange.
const string name = "FakeProvider";
const string state = "this-is-some-state";
var authenticationServiceSettings = new FakeAuthencationServiceSettings(name);
var authenticationService = new AuthenticationService();
var querystringParameters = new NameValueCollection {{"state", state}};
// Act.
var authenticatedClient = authenticationService.GetAuthenticatedClient(authenticationServiceSettings, querystringParameters);
// Assert.
Assert.NotNull(authenticatedClient);
Assert.Equal(name, authenticatedClient.ProviderName);
Assert.NotNull(authenticatedClient.AccessToken);
Assert.NotNull(authenticatedClient.UserInformation);
Assert.Equal("FakeId-ABCDEFGHIJKLMNOPQRSTUVWXYZ", authenticatedClient.UserInformation.Id);
}