public void BuildUrl_Generates_Languages_Url()
        {
            const string ExpectedUrl = "https://api.twitter.com/1.1/help/languages.json";
            var helpReqProc = new HelpRequestProcessor<Help> { BaseUrl = "https://api.twitter.com/1.1/" };
            var parameters = new Dictionary<string, string>
             {
                 {"Type", ((int) HelpType.Languages).ToString()}
             };

            Request req = helpReqProc.BuildUrl(parameters);

            Assert.AreEqual(ExpectedUrl, req.FullUrl);
        }
        public void BuildUrl_Generates_RateLimits_Url()
        {
            const string ExpectedUrl = "https://api.twitter.com/1.1/application/rate_limit_status.json?resources=search%2Cusers";
            var helpReqProc = new HelpRequestProcessor<Help> { BaseUrl = "https://api.twitter.com/1.1/" };
            var parameters = new Dictionary<string, string>
             {
                 {"Type", ((int) HelpType.RateLimits).ToString()},
                 {"Resources", "search,users"}
             };

            Request req = helpReqProc.BuildUrl(parameters);

            Assert.AreEqual(ExpectedUrl, req.FullUrl);
        }
示例#3
0
        public void BuildUrl_Throws_With_No_Type()
        {
            var helpReqProc = new HelpRequestProcessor <Help> {
                BaseUrl = "https://api.twitter.com/1/"
            };
            var parameters = new Dictionary <string, string>
            {
                //{"Type", ((int) HelpType.Languages).ToString()}
            };

            var ex = L2TAssert.Throws <ArgumentException>(() => helpReqProc.BuildUrl(parameters));

            Assert.AreEqual("Type", ex.ParamName);
        }
示例#4
0
        public void BuildUrl_Generates_Languages_Url()
        {
            const string ExpectedUrl = "https://api.twitter.com/1.1/help/languages.json";
            var          helpReqProc = new HelpRequestProcessor <Help> {
                BaseUrl = "https://api.twitter.com/1.1/"
            };
            var parameters = new Dictionary <string, string>
            {
                { "Type", ((int)HelpType.Languages).ToString() }
            };

            Request req = helpReqProc.BuildUrl(parameters);

            Assert.AreEqual(ExpectedUrl, req.FullUrl);
        }
示例#5
0
        public void BuildUrl_Removes_Parameter_Spaces_In_RateLimits_Url()
        {
            const string ExpectedUrl = "https://api.twitter.com/1.1/application/rate_limit_status.json?resources=search%2Cusers";
            var          helpReqProc = new HelpRequestProcessor <Help> {
                BaseUrl = "https://api.twitter.com/1.1/"
            };
            var parameters = new Dictionary <string, string>
            {
                { "Type", ((int)HelpType.RateLimits).ToString() },
                { "Resources", "search, users" }
            };

            Request req = helpReqProc.BuildUrl(parameters);

            Assert.AreEqual(ExpectedUrl, req.FullUrl);
        }
        public void BuildUrl_Throws_With_No_Type()
        {
            var helpReqProc = new HelpRequestProcessor<Help> { BaseUrl = "https://api.twitter.com/1/" };
            var parameters = new Dictionary<string, string>
            {
                //{"Type", ((int) HelpType.Languages).ToString()}
            };

            var ex = L2TAssert.Throws<ArgumentException>(() => helpReqProc.BuildUrl(parameters));

            Assert.AreEqual("Type", ex.ParamName);
        }