public void ValidHashReturnsTrue() { UserCredential cred = new UserCredential("test", "token1", "token2"); string hash = cred.GenerateHash(); Assert.True(cred.VerifyHash(hash)); }
public void InvalidHashReturnsFalse() { UserCredential cred = new UserCredential("test", "token1", "token2"); string hash = cred.GenerateHash() + "errortest"; Assert.False(cred.VerifyHash(hash)); }
public bool ChangeUserCredentials(string handle, string hash, string eventName) { UserCredential uc = Users.Find(u => u.Handle == handle); if (uc != null && uc.VerifyHash(hash)) { TwitterStream ts = GetStream(eventName); ts.AccessToken = uc.GetAccessToken(); ts.AccessTokenSecret = uc.GetAccessSecret(); ts.UpdateCredentials(); return(true); } return(false); }