Пример #1
0
        public void BuildAuthenticationUrl_WithMultipleScopesDefined()
        {
            string clientId = "foo";
            string redirectUrl = "bar";
            var scopes = new[] {Scope.PublicRepo, Scope.Repo, Scope.Gists, Scope.User};
            string expectedUrl = string.Format("{0}?client_id={1}&redirect_uri={2}&scope={3}",
                                               Constants.AuthenticationUrl,
                                               clientId,
                                               redirectUrl,
                                               "public_repo,repo,gists,user");
            var auth = new GitHubOAuthAuthorizer();

            string actualUrl = auth.BuildAuthenticationUrl(clientId, redirectUrl, scopes);

            Assert.AreEqual(expectedUrl, actualUrl);
        }
Пример #2
0
        public void BuildAuthenticationUrl_WithNoScopesDefined()
        {
            string clientId = "foo";
            string redirectUrl = "bar";
            string expectedUrl = string.Format("{0}?client_id={1}&redirect_uri={2}",
                                               Constants.AuthenticationUrl,
                                               clientId,
                                               redirectUrl);
            var auth = new GitHubOAuthAuthorizer();

            string actualUrl = auth.BuildAuthenticationUrl(clientId, redirectUrl);

            Assert.AreEqual(expectedUrl, actualUrl);
        }