public async void Connect() { if (!this.applicationOnlyToken.IsFieldEmpty) { return; } this.ResultsVisibility = false; this.Error = string.Empty; var value = await TwitterApplicationOnlyAuthService.CreateInstance(this.applicationOnlyToken); if (value.OAuthAccessToken == null) { this.Error = " Application only aunthentication failed!"; this.SearchCollapsableVisibility = false; this.SearchVisibility = false; } else { this.Error = string.Empty; this.SearchCollapsableVisibility = true; this.SearchVisibility = true; this.AuthenticationVisibility = false; this.AuthenticationContent = ""; this.SearchContent = ""; } }
public void ApplicationOnlyAuthenticationServiceReturnsInValidToken() { TwitterApplicationOnlyOAuthTokens token = new TwitterApplicationOnlyOAuthTokens() { OAuthConsumerKey = "SHQOPnuC1CzXHo88", OAuthConsumerSecret = "jFRdYTc9ZLOnwOEJBJWmY4Nx1HOV4e" }; var oathToken = TwitterApplicationOnlyAuthService.CreateInstance(token); Assert.IsTrue(oathToken.Result.OAuthAccessToken == null); }
public void GetNoFeedsInvalidData() { TwitterApplicationOnlyOAuthTokens token = new TwitterApplicationOnlyOAuthTokens() { OAuthConsumerKey = "SHQOPnu3HknPnVQ1C1CzXHo88", OAuthConsumerSecret = "jFRdYXi7bAczFZZ5oB28feBhkTc9ZLOnwOEJBJWmY4Nx1HOV4e" }; var oathToken = TwitterApplicationOnlyAuthService.CreateInstance(token); var twitterService = new TwitterFeedsService(); var twits = twitterService.GetTimeline("inv"); Assert.AreEqual(twits.Result.Count(), 0); }
public async Task GetFeedsSuccessfully() { TwitterApplicationOnlyOAuthTokens token = new TwitterApplicationOnlyOAuthTokens() { OAuthConsumerKey = "SHQOPnu3HknPnVQ1C1CzXHo88", OAuthConsumerSecret = "jFRdYXi7bAczFZZ5oB28feBhkTc9ZLOnwOEJBJWmY4Nx1HOV4e" }; var oathToken = TwitterApplicationOnlyAuthService.CreateInstance(token); var twitterService = new TwitterFeedsService(); var twits = await twitterService.GetTimeline("Jon Skeet"); Assert.AreEqual(twits.Count(), 20); }