Пример #1
0
            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);
            }
            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);
            }