예제 #1
0
        public void AuthenticateConsumerNullParameter()
        {
            //Arrange
            AuthenticateSettings obAuthSettings = null;

            //Act
            IAuthenticate obAuthenticate = new Authenticate();
            AuthResponse  obAuthRespose  = obAuthenticate.AuthenticateConsumer(obAuthSettings);

            //Assert
            // When null parameter is passed, the expected output is null Authentication Response.
            Assert.AreEqual(obAuthRespose, null);
        }
예제 #2
0
        public void AuthenticateConsumerEmptyOAuthConsumerSecret()
        {
            //Arrange
            AuthenticateSettings obAuthSettings = new AuthenticateSettings();

            obAuthSettings.OAuthConsumerSecret = string.Empty;

            //Act
            IAuthenticate obAuthenticate = new Authenticate();
            AuthResponse  obAuthRespose  = obAuthenticate.AuthenticateConsumer(obAuthSettings);

            //Assert
            // When Consumer Secret is empty, the expected output is null Authentication Response.
            Assert.AreEqual(obAuthRespose, null);
        }
예제 #3
0
        public void AuthenticateConsumerNullOAuthConsumerKey()
        {
            //Arrange
            AuthenticateSettings obAuthSettings = new AuthenticateSettings();

            obAuthSettings.OAuthConsumerKey = null;

            //Act
            IAuthenticate obAuthenticate = new Authenticate();
            AuthResponse  obAuthRespose  = obAuthenticate.AuthenticateConsumer(obAuthSettings);

            //Assert
            // When Consumer key is null, the expected output is null Authentication Response.
            Assert.AreEqual(obAuthRespose, null);
        }
예제 #4
0
        public void AuthenticateConsumerWithValidParameter()
        {
            //Arrange
            //**This Key needs to be replaced in case if it has expired for any reason
            AuthenticateSettings obAuthSettings = new AuthenticateSettings();

            obAuthSettings.OAuthConsumerKey    = "yEkVQqHKfqeLDiPBnGk6xtOHJ";
            obAuthSettings.OAuthConsumerSecret = "ASrjZGIQCFsBewxYYlnkKM45FHkniu0Uk8saKhZ0kloXO6d2Fy";
            obAuthSettings.OAuthUrl            = "https://api.twitter.com/oauth2/token";
            //Act
            IAuthenticate obAuthenticate = new Authenticate();
            AuthResponse  obAuthRespose  = obAuthenticate.AuthenticateConsumer(obAuthSettings);

            //Assert
            // When all valid parameter is passed, response is expected with access token
            Assert.IsTrue(obAuthRespose.TokenType != null && obAuthRespose.AccessToken != null);
        }
예제 #5
0
        public void AuthenticateConsumerWithInValidAuthCredential()
        {
            //Arrange
            //**This Key needs to be replaced in case if it has expired for any reason
            AuthenticateSettings obAuthSettings = new AuthenticateSettings();

            obAuthSettings.OAuthConsumerKey    = "DummyKey";
            obAuthSettings.OAuthConsumerSecret = "DummySecret";
            obAuthSettings.OAuthUrl            = "https://api.twitter.com/oauth2/token";
            //Act
            IAuthenticate obAuthenticate = new Authenticate();
            AuthResponse  obAuthRespose  = obAuthenticate.AuthenticateConsumer(obAuthSettings);

            //Assert
            // When all valid parameter is passed, response is expected with access token
            //Exception is ecxpected
        }