Exemplo n.º 1
0
        public void CtorTest()
        {
            const string clientID = "MyClientID";
            const string clientSecret = "MyClientSecret";

            var gh = new GitHubAuthenticationClient(clientID, clientSecret);

            Assert.AreEqual(clientID, gh.ClientID);
            Assert.AreEqual(clientSecret, gh.ClientSecret);
            Assert.AreEqual("GitHub", gh.ProviderName);
        }
Exemplo n.º 2
0
        public void GetServiceLoginUrl_ShouldBuildCorrectUrl()
        {
            const string clientID = "MyClientID";
            const string clientSecret = "MyClientSecret";
            const string redirectUri = "http://localhost/Account/ExternalLoginCallback";

            var gh = new GitHubAuthenticationClient(clientID, clientSecret);

            var result = gh.GetServiceLoginUrlInternal(new Uri(redirectUri));

            Assert.IsNotNull(result);

            string expected = "https://github.com/login/oauth/authorize?client_id=myclientid&redirect_uri=http:%2f%2flocalhost%2faccount%2fexternallogincallback";

            Assert.AreEqual(expected, result.ToString().ToLower());
        }