public void CreateTweetUserFromSignInTwitterUserID_ValidInput_ReturnsTrue() { bool _userCreated = false; var siteId = 1; var tweetUser = new TweetUser() { ScreenName = "Sachin", id = "1" }; var user = CreateTwitterUser(siteId, tweetUser.id, tweetUser.ScreenName, true); _userCreated = user.CreateUserFromTwitterUserID(siteId, tweetUser); Assert.IsTrue(_userCreated); }
public bool CreateUserFromTwitterUser(int siteID, TweetUser tweetUser) { if (tweetUser.id == null || tweetUser.id.Length == 0) throw new ArgumentException("Invalid twitterUserId parameter"); if (siteID == 0) throw new ArgumentException("Invalid siteID parameter"); TwitterUserID = tweetUser.id; if (base.CreateUserFromTwitterUserID(siteID, tweetUser)) { //method for retrieving the twitter user groups GetUsersGroupsForSite(); return true; } return false; }
public void CreateTweetUserFromSignInTwitterUserID_NoSiteID_ReturnsFalse() { bool _userCreated = false; var siteId = 0; var tweetUser = new TweetUser() { ScreenName = "Sachin", id = "1" }; var user = CreateTwitterUser(siteId, tweetUser.id, tweetUser.ScreenName, true); try { _userCreated = user.CreateUserFromTwitterUserID(siteId, tweetUser); } catch (ArgumentException ex) { // Expecting an ArgumentException that mentions the twitterUserID id Assert.IsTrue(ex.Message.ToLower().Contains("siteid")); return; } Assert.Fail("Shouldn't get this far"); }
public void CreateTweetUserFromSignInTwitterUserID_NoRows_ReturnsFalse() { bool userCreated = false; var siteId = 1; var tweetUser = new TweetUser() { ScreenName = "Sachin", id = "1" }; var user = CreateTwitterUser(siteId, tweetUser.id, tweetUser.ScreenName, false); userCreated = user.CreateUserFromTwitterUserID(siteId, tweetUser); Assert.IsFalse(userCreated); }
/// <summary> /// Check to see if the tweet user is a trusted user /// </summary> /// <param name="siteID"></param> /// <param name="tweetUser"></param> /// <returns></returns> public bool IsTweetUserATrustedUser(int siteID, TweetUser tweetUser) { if (tweetUser.id == null || tweetUser.id.Length == 0) throw new ArgumentException("Invalid twitterUserId parameter"); if (siteID == 0) throw new ArgumentException("Invalid siteID parameter"); using (IDnaDataReader reader = CreateStoreProcedureReader("istweetuseratrusteduser")) { reader.AddParameter("twitteruserid", tweetUser.id); reader.AddParameter("siteid", siteID); reader.Execute(); if (reader.Read() && reader.HasRows) { // Get the id for the user. SiteID = siteID; ReadUserDetails(reader); return true; } } return false; }