Example #1
0
        public void BuildIDsURLTest()
        {
            BlocksRequestProcessor <Blocks> target = new BlocksRequestProcessor <Blocks>()
            {
                BaseUrl = "http://twitter.com/"
            };
            Dictionary <string, string> parameters =
                new Dictionary <string, string>
            {
                { "Type", ((int)BlockingType.IDS).ToString() }
            };
            string expected = "http://twitter.com/blocks/blocking/ids.xml";
            string actual   = target.BuildURL(parameters);

            Assert.AreEqual(expected, actual);
        }
Example #2
0
        public void BuildBlockingURLTest()
        {
            BlocksRequestProcessor target = new BlocksRequestProcessor()
            {
                BaseUrl = "http://twitter.com/"
            };
            Dictionary <string, string> parameters =
                new Dictionary <string, string>
            {
                { "Type", ((int)BlockingType.Blocking).ToString() },
                { "Page", "2" }
            };
            string expected = "http://twitter.com/blocks/blocking.xml?page=2";
            string actual   = target.BuildURL(parameters);

            Assert.AreEqual(expected, actual);
        }
Example #3
0
        public void NullParametersTest()
        {
            BlocksRequestProcessor <Blocks> target = new BlocksRequestProcessor <Blocks>()
            {
                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);
            }
        }
Example #4
0
        public void BuildExistsURLTest()
        {
            BlocksRequestProcessor <Blocks> target = new BlocksRequestProcessor <Blocks>()
            {
                BaseUrl = "http://twitter.com/"
            };
            Dictionary <string, string> parameters =
                new Dictionary <string, string>
            {
                { "Type", ((int)BlockingType.Exists).ToString() },
                { "ID", "123" },
                { "UserID", "456" },
                { "ScreenName", "789" }
            };
            string expected = "http://twitter.com/blocks/exists/123.xml?user_id=456&screen_name=789";
            string actual   = target.BuildURL(parameters);

            Assert.AreEqual(expected, actual);
        }
 public void NullParametersTest()
 {
     BlocksRequestProcessor<Blocks> target = new BlocksRequestProcessor<Blocks>() { 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 BuildIDsURLTest()
 {
     BlocksRequestProcessor<Blocks> target = new BlocksRequestProcessor<Blocks>() { BaseUrl = "http://twitter.com/" };
     Dictionary<string, string> parameters =
         new Dictionary<string, string>
         {
             { "Type", ((int)BlockingType.IDS).ToString() }
         };
     string expected = "http://twitter.com/blocks/blocking/ids.xml";
     string actual = target.BuildURL(parameters);
     Assert.AreEqual(expected, actual);
 }
 public void BuildExistsURLTest()
 {
     BlocksRequestProcessor<Blocks> target = new BlocksRequestProcessor<Blocks>() { BaseUrl = "http://twitter.com/" };
     Dictionary<string, string> parameters =
         new Dictionary<string, string>
         {
             { "Type", ((int)BlockingType.Exists).ToString() },
             { "ID", "123" },
             { "UserID", "456" },
             { "ScreenName", "789" }
         };
     string expected = "http://twitter.com/blocks/exists/123.xml?user_id=456&screen_name=789";
     string actual = target.BuildURL(parameters);
     Assert.AreEqual(expected, actual);
 }