Beispiel #1
0
 public void setAuthLinkTest()
 {
     OAuthDialog target = new OAuthDialog();
     string authentication_link = "http://www.flickr.com";
     target.setAuthLink(authentication_link);
     Assert.AreEqual(authentication_link, target.OAuthLink.Text);
 }
Beispiel #2
0
 public void getAuthenticationDataTest()
 {
     OAuthDialog target = new OAuthDialog();
     target.OAuthData.Text = "abc";
     string expected = "abc";
     string actual;
     actual = target.getAuthenticationData();
     Assert.AreEqual(expected, actual);
 }
Beispiel #3
0
 public void WarningMessageTest()
 {
     OAuthDialog target = new OAuthDialog();
     string message = "Warning";
     target.WarningMessage(message);
 }
Beispiel #4
0
 public void OAuthDialogConstructorTest()
 {
     OAuthDialog target = new OAuthDialog();
     Assert.IsNotNull(target);
     target.Close();
 }
Beispiel #5
0
        private void authorize(IOAuthDialog authDialog = null)
        {
            if (authDialog == null)
                authDialog = new OAuthDialog();

            OAuthRequestToken rtoken = flickrHandle.OAuthGetRequestToken("oob");
            String url = flickrHandle.OAuthCalculateAuthorizationUrl(rtoken.Token, AuthLevel.Delete);

            System.Diagnostics.Process.Start(url);
            authDialog.setAuthLink(url);

            if (authDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                try
                {
                    String access_code = authDialog.getAuthenticationData();
                    OAuthAccessToken atoken = flickrHandle.OAuthGetAccessToken(rtoken, access_code);
                    authToken = atoken.Token;
                }
                catch
                {
                    authDialog.WarningMessage("Authentication failed");
                }
            }
        }