Esempio n. 1
0
        public void ValidHashReturnsTrue()
        {
            UserCredential cred = new UserCredential("test", "token1", "token2");
            string         hash = cred.GenerateHash();

            Assert.True(cred.VerifyHash(hash));
        }
Esempio n. 2
0
        public void InvalidHashReturnsFalse()
        {
            UserCredential cred = new UserCredential("test", "token1", "token2");
            string         hash = cred.GenerateHash() + "errortest";

            Assert.False(cred.VerifyHash(hash));
        }
Esempio n. 3
0
        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);
        }