Exemple #1
0
        public void BuildUrl_Throws_With_No_Parameters()
        {
            var trendReqProc = new TrendRequestProcessor <Trend> {
                BaseUrl = "https://api.twitter.com/1.1/"
            };

            var ex = Assert.Throws <ArgumentException>(() => trendReqProc.BuildUrl(null));

            Assert.Equal("Type", ex.ParamName);
        }
Exemple #2
0
        public void BuildUrl_Throws_When_Type_Not_Provided()
        {
            var trendReqProc = new TrendRequestProcessor <Trend> {
                BaseUrl = "https://api.twitter.com/1.1/"
            };
            var parameters = new Dictionary <string, string>();

            var ex = Assert.Throws <ArgumentException>(() => trendReqProc.BuildUrl(parameters));

            Assert.Equal("Type", ex.ParamName);
        }
Exemple #3
0
        public void BuildUrl_Throws_On_Place_Trends_WithoutWoeID()
        {
            var trendReqProc = new TrendRequestProcessor <Trend> {
                BaseUrl = "https://api.twitter.com/1.1/"
            };
            var parameters =
                new Dictionary <string, string>
            {
                { "Type", ((int)TrendType.Place).ToString(CultureInfo.InvariantCulture) },
            };

            var ex = Assert.Throws <ArgumentException>(() => trendReqProc.BuildUrl(parameters));

            Assert.Equal("WoeID", ex.ParamName);
        }
Exemple #4
0
        public void BuildUrl_Constructs_AvailableTrends_Url()
        {
            const string ExpectedUrl  = "https://api.twitter.com/1.1/trends/available.json";
            var          trendReqProc = new TrendRequestProcessor <Trend> {
                BaseUrl = "https://api.twitter.com/1.1/"
            };
            var parameters =
                new Dictionary <string, string>
            {
                { "Type", ((int)TrendType.Available).ToString(CultureInfo.InvariantCulture) }
            };

            Request req = trendReqProc.BuildUrl(parameters);

            Assert.Equal(ExpectedUrl, req.FullUrl);
        }
Exemple #5
0
        public void BuildUrl_Constructs_Place_Trends_Url()
        {
            const string ExpectedUrl  = "https://api.twitter.com/1.1/trends/place.json?id=1";
            var          trendReqProc = new TrendRequestProcessor <Trend> {
                BaseUrl = "https://api.twitter.com/1.1/"
            };
            var parameters =
                new Dictionary <string, string>
            {
                { "Type", ((int)TrendType.Place).ToString(CultureInfo.InvariantCulture) },
                { "WoeID", "1" }
            };

            Request req = trendReqProc.BuildUrl(parameters);

            Assert.AreEqual(ExpectedUrl, req.FullUrl);
        }
Exemple #6
0
        public void BuildUrl_Constructs_ClosestTrends_Url()
        {
            const string ExpectedUrl  = "https://api.twitter.com/1.1/trends/closest.json?lat=37.78215&long=-122.40060";
            var          trendReqProc = new TrendRequestProcessor <Trend> {
                BaseUrl = "https://api.twitter.com/1.1/"
            };
            var parameters =
                new Dictionary <string, string>
            {
                { "Type", ((int)TrendType.Closest).ToString(CultureInfo.InvariantCulture) },
                { "Latitude", "37.78215" },
                { "Longitude", "-122.40060" }
            };

            Request req = trendReqProc.BuildUrl(parameters);

            Assert.Equal(ExpectedUrl, req.FullUrl);
        }
        public void BuildUrl_Throws_With_No_Parameters()
        {
            var trendReqProc = new TrendRequestProcessor<Trend> { BaseUrl = "https://api.twitter.com/1.1/" };

            var ex = Assert.Throws<ArgumentException>(() => trendReqProc.BuildUrl(null));

            Assert.Equal("Type", ex.ParamName);
        }
        public void BuildUrl_Throws_When_Type_Not_Provided()
        {
            var trendReqProc = new TrendRequestProcessor<Trend> { BaseUrl = "https://api.twitter.com/1.1/" };
            var parameters = new Dictionary<string, string>();

            var ex = Assert.Throws<ArgumentException>(() => trendReqProc.BuildUrl(parameters));

            Assert.Equal("Type", ex.ParamName);
        }
        public void BuildUrl_Throws_On_Place_Trends_WithoutWoeID()
        {
            var trendReqProc = new TrendRequestProcessor<Trend> { BaseUrl = "https://api.twitter.com/1.1/" };
            var parameters =
                new Dictionary<string, string>
                {
                    { "Type", ((int)TrendType.Place).ToString(CultureInfo.InvariantCulture) },
                };

            var ex = Assert.Throws<ArgumentException>(() => trendReqProc.BuildUrl(parameters));

            Assert.Equal("WoeID", ex.ParamName);
        }
        public void BuildUrl_Handles_Available_Trends()
        {
            const string ExpectedUrl = "https://api.twitter.com/1.1/trends/available.json";
            var trendReqProc = new TrendRequestProcessor<Trend> { BaseUrl = "https://api.twitter.com/1.1/" };
            var parameters =
                new Dictionary<string, string>
                {
                    { "Type", ((int)TrendType.Available).ToString(CultureInfo.InvariantCulture) }
                };

            Request req = trendReqProc.BuildUrl(parameters);

            Assert.Equal(ExpectedUrl, req.FullUrl);
        }
        public void BuildUrl_Constructs_Place_Trends_Url()
        {
            const string ExpectedUrl = "https://api.twitter.com/1.1/trends/place.json?id=1";
            var trendReqProc = new TrendRequestProcessor<Trend> { BaseUrl = "https://api.twitter.com/1.1/" };
            var parameters =
                new Dictionary<string, string>
                {
                    { "Type", ((int)TrendType.Place).ToString(CultureInfo.InvariantCulture) },
                    { "WoeID", "1" }
                };

            Request req = trendReqProc.BuildUrl(parameters);

            Assert.Equal(ExpectedUrl, req.FullUrl);
        }
        public void BuildUrl_Constructs_ClosestTrends_Url()
        {
            const string ExpectedUrl = "https://api.twitter.com/1.1/trends/closest.json?lat=37.78215&long=-122.40060";
            var trendReqProc = new TrendRequestProcessor<Trend> { BaseUrl = "https://api.twitter.com/1.1/" };
            var parameters =
                new Dictionary<string, string>
                {
                    { "Type", ((int)TrendType.Closest).ToString(CultureInfo.InvariantCulture) },
                    { "Latitude", "37.78215" },
                    { "Longitude", "-122.40060" }
                };

            Request req = trendReqProc.BuildUrl(parameters);

            Assert.Equal(ExpectedUrl, req.FullUrl);
        }