Beispiel #1
0
        public void BuildUrlTest()
        {
            var dmProc = new DirectMessageRequestProcessor()
            {
                BaseUrl = "http://twitter.com/"
            };
            string expected = "http://twitter.com/direct_messages.xml";
            Dictionary <string, string> parameters = null;
            string actual = dmProc.BuildURL(parameters);

            Assert.AreEqual(expected, actual);
        }
Beispiel #2
0
        public void BuildUrlSentByTest()
        {
            var dmProc = new DirectMessageRequestProcessor()
            {
                BaseUrl = "http://twitter.com/"
            };
            string expected = "http://twitter.com/direct_messages/sent.xml";
            Dictionary <string, string> parameters =
                new Dictionary <string, string>
            {
                { "Type", ((int)DirectMessageType.SentBy).ToString() }
            };
            string actual = dmProc.BuildURL(parameters);

            Assert.AreEqual(expected, actual);
        }
        public void NullParametersTest()
        {
            DirectMessageRequestProcessor <DirectMessage> target = new DirectMessageRequestProcessor <DirectMessage>()
            {
                BaseUrl = "http://twitter.com/"
            };
            Dictionary <string, string> parameters = null;
            string actual;

            try
            {
                actual = target.BuildURL(parameters);
                Assert.Fail("Expected ArgumentException.");
            }
            catch (ArgumentException ae)
            {
                Assert.AreEqual <string>("Type", ae.ParamName);
            }
        }
        public void BuildUrlSentByTest()
        {
            var dmProc = new DirectMessageRequestProcessor <DirectMessage>()
            {
                BaseUrl = "http://twitter.com/"
            };
            string expected = "http://twitter.com/direct_messages/sent.xml?since_id=1234567&max_id=357&page=1&count=2";
            Dictionary <string, string> parameters =
                new Dictionary <string, string>
            {
                { "Type", ((int)DirectMessageType.SentBy).ToString() },
                { "SinceID", "1234567" },
                { "MaxID", "357" },
                { "Page", "1" },
                { "Count", "2" }
            };
            string actual = dmProc.BuildURL(parameters);

            Assert.AreEqual(expected, actual);
        }
 public void NullParametersTest()
 {
     DirectMessageRequestProcessor<DirectMessage> target = new DirectMessageRequestProcessor<DirectMessage>() { BaseUrl = "http://twitter.com/" };
     Dictionary<string, string> parameters = null;
     string actual;
     try
     {
         actual = target.BuildURL(parameters);
         Assert.Fail("Expected ArgumentException.");
     }
     catch (ArgumentException ae)
     {
         Assert.AreEqual<string>("Type", ae.ParamName);
     }
 }
 public void BuildUrlSentToSinceIDTest()
 {
     var dmProc = new DirectMessageRequestProcessor<DirectMessage>() { BaseUrl = "http://twitter.com/" };
     string expected = "http://twitter.com/direct_messages.xml?since_id=1234567&max_id=357&page=1&count=2";
     Dictionary<string, string> parameters =
         new Dictionary<string, string>
         {
                 { "Type", ((int)DirectMessageType.SentTo).ToString() },
                 { "SinceID", "1234567" },
                 { "MaxID", "357" },
                 { "Page", "1" },
                 { "Count", "2" }
         };
     string actual = dmProc.BuildURL(parameters);
     Assert.AreEqual(expected, actual);
 }