当前位置: 首页>>代码示例>>C#>>正文


C# AuthenticationService.GetAuthenticatedClient方法代码示例

本文整理汇总了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);
            }
开发者ID:jchannon,项目名称:World-Domination.Web.Authentication,代码行数:13,代码来源:AuthenticationServiceFacts.cs

示例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);
            }
开发者ID:kowalgta,项目名称:WorldDomination.Web.Authentication,代码行数:15,代码来源:AuthenticationServiceFacts.cs

示例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);
            }
开发者ID:ActivePHOENiX,项目名称:SimpleAuthentication,代码行数:19,代码来源:AuthenticationServiceFacts.cs


注:本文中的AuthenticationService.GetAuthenticatedClient方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。