public void BuildUrlForSearch_WithQueryButNotLatLongAndIP_ExpectSuccess() { const string ExpectedUrl = "https://api.twitter.com/1.1/geo/search.json?query=Twitter%20HQ&accuracy=city&granularity=10&max_results=10&contained_within=123&attribute%3Astreet_address=123"; var geoReqProc = new GeoRequestProcessor <Geo>() { BaseUrl = "https://api.twitter.com/1.1/" }; var parameters = new Dictionary <string, string> { { "Type", ((int)GeoType.Search).ToString() }, //{"Latitude", (37.78215).ToString()}, //{"Longitude", (-122.40060).ToString()}, { "Query", "Twitter HQ" }, //{"IP", "168.143.171.180"}, { "Accuracy", "city" }, { "Granularity", "10" }, { "MaxResults", "10" }, { "ContainedWithin", "123" }, { "Attribute", "street_address=123" } }; Request req = geoReqProc.BuildUrl(parameters); Assert.AreEqual(ExpectedUrl, req.FullUrl); }
public void BuildUrl_ID_Without_ID_Throws() { const string ExpectedIDParamName = "ID"; var geoReqProc = new GeoRequestProcessor <Geo>() { BaseUrl = "https://api.twitter.com/1.1/" }; var parameters = new Dictionary <string, string> { { "Type", ((int)GeoType.ID).ToString() }, }; var ex = L2TAssert.Throws <ArgumentException>(() => geoReqProc.BuildUrl(parameters)); Assert.AreEqual(ExpectedIDParamName, ex.ParamName); }
public void BuildUrl_Constructs_ID_Url() { const string ExpectedUrl = "https://api.twitter.com/1.1/geo/id/7695dd2ec2f86f2b.json"; var geoReqProc = new GeoRequestProcessor <Geo>() { BaseUrl = "https://api.twitter.com/1.1/" }; var parameters = new Dictionary <string, string> { { "Type", ((int)GeoType.ID).ToString() }, { "ID", "7695dd2ec2f86f2b" }, }; Request req = geoReqProc.BuildUrl(parameters); Assert.AreEqual(ExpectedUrl, req.FullUrl); }
public void BuildUrl_Search_With_Attribute_Missing_Equals_Symbol_Throws() { const string ExpectedAttributeParam = "Attribute"; var geoReqProc = new GeoRequestProcessor <Geo>() { BaseUrl = "https://api.twitter.com/1.1/" }; var parameters = new Dictionary <string, string> { { "Type", ((int)GeoType.Search).ToString() }, { "IP", "168.143.171.180" }, { "Attribute", "street_address" } }; var ex = L2TAssert.Throws <ArgumentException>(() => geoReqProc.BuildUrl(parameters)); Assert.AreEqual(ExpectedAttributeParam, ex.ParamName); }
public void BuildUrlReverseL_WithoutLatLongIPOrQuery_ExpectException() { const string ExpectedLatLongParamName = "LatLong"; var geoReqProc = new GeoRequestProcessor <Geo>() { BaseUrl = "https://api.twitter.com/1.1/" }; var parameters = new Dictionary <string, string> { { "Type", ((int)GeoType.Reverse).ToString() }, { "Accuracy", "city" }, { "Granularity", "10" }, { "MaxResults", "10" } }; var ex = L2TAssert.Throws <ArgumentException>(() => geoReqProc.BuildUrl(parameters)); Assert.AreEqual(ExpectedLatLongParamName, ex.ParamName); }
public void BuildUrl_Constructs_Reverse_Url() { const string ExpectedUrl = "https://api.twitter.com/1.1/geo/reverse_geocode.json?lat=37.78215&long=-122.4006&accuracy=city&granularity=10&max_results=10"; var geoReqProc = new GeoRequestProcessor <Geo>() { BaseUrl = "https://api.twitter.com/1.1/" }; var parameters = new Dictionary <string, string> { { "Type", ((int)GeoType.Reverse).ToString() }, { "Latitude", "37.78215" }, { "Longitude", "-122.40060" }, { "Accuracy", "city" }, { "Granularity", "10" }, { "MaxResults", "10" } }; Request req = geoReqProc.BuildUrl(parameters); Assert.AreEqual(ExpectedUrl, req.FullUrl); }
public void BuildUrl_For_Similar_Places_Requires_PlaceName() { const string ExpectedParamName = "PlaceName"; var geoReqProc = new GeoRequestProcessor <Geo>() { BaseUrl = "https://api.twitter.com/1.1/" }; var parameters = new Dictionary <string, string> { { "Type", ((int)GeoType.SimilarPlaces).ToString() }, { "Latitude", "37.78215" }, { "Longitude", "-122.40060" }, //{"PlaceName", "placeName" }, { "ContainedWithin", "123" }, { "Attribute", "street_address=123" } }; var ex = L2TAssert.Throws <ArgumentException>(() => geoReqProc.BuildUrl(parameters)); Assert.AreEqual(ExpectedParamName, ex.ParamName); }
public void BuildUrl_Constructs_Similar_Places_Url() { const string ExpectedUrl = "https://api.twitter.com/1.1/geo/similar_places.json?lat=37.78215&long=-122.4006&name=placeName&contained_within=123&attribute%3Astreet_address=123"; var geoReqProc = new GeoRequestProcessor <Geo>() { BaseUrl = "https://api.twitter.com/1.1/" }; var parameters = new Dictionary <string, string> { { "Type", ((int)GeoType.SimilarPlaces).ToString() }, { "Latitude", (37.78215).ToString() }, { "Longitude", (-122.40060).ToString() }, { "PlaceName", "placeName" }, { "ContainedWithin", "123" }, { "Attribute", "street_address=123" } }; Request req = geoReqProc.BuildUrl(parameters); Assert.AreEqual(ExpectedUrl, req.FullUrl); }
public void BuildUrl_Search_With_Attribute_Missing_Equals_Symbol_Throws() { const string ExpectedAttributeParam = "Attribute"; var geoReqProc = new GeoRequestProcessor<Geo>() { BaseUrl = "https://api.twitter.com/1.1/" }; var parameters = new Dictionary<string, string> { {"Type", ((int) GeoType.Search).ToString()}, {"IP", "168.143.171.180"}, {"Attribute", "street_address" } }; var ex = Assert.Throws<ArgumentException>(() => geoReqProc.BuildUrl(parameters)); Assert.Equal(ExpectedAttributeParam, ex.ParamName); }
public void BuildUrl_ReverseL_Without_LatLong_Throws() { const string ExpectedLatLongParamName = "LatLong"; var geoReqProc = new GeoRequestProcessor<Geo>() { BaseUrl = "https://api.twitter.com/1.1/" }; var parameters = new Dictionary<string, string> { {"Type", ((int) GeoType.Reverse).ToString()}, {"Accuracy", "city" }, {"Granularity", "10" }, {"MaxResults", "10" } }; var ex = Assert.Throws<ArgumentException>(() => geoReqProc.BuildUrl(parameters)); Assert.Equal(ExpectedLatLongParamName, ex.ParamName); }
public void BuildUrl_ID_Without_ID_Throws() { const string ExpectedIDParamName = "ID"; var geoReqProc = new GeoRequestProcessor<Geo>() { BaseUrl = "https://api.twitter.com/1.1/" }; var parameters = new Dictionary<string, string> { {"Type", ((int) GeoType.ID).ToString()}, }; var ex = Assert.Throws<ArgumentException>(() => geoReqProc.BuildUrl(parameters)); Assert.Equal(ExpectedIDParamName, ex.ParamName); }
public void BuildUrl_For_Similar_Places_Requires_PlaceName() { const string ExpectedParamName = "PlaceName"; var geoReqProc = new GeoRequestProcessor<Geo>() { BaseUrl = "https://api.twitter.com/1.1/" }; var parameters = new Dictionary<string, string> { {"Type", ((int) GeoType.SimilarPlaces).ToString()}, {"Latitude", "37.78215"}, {"Longitude", "-122.40060"}, //{"PlaceName", "placeName" }, {"ContainedWithin", "123" }, {"Attribute", "street_address=123" } }; var ex = Assert.Throws<ArgumentException>(() => geoReqProc.BuildUrl(parameters)); Assert.Equal(ExpectedParamName, ex.ParamName); }
public void BuildUrl_Constructs_Similar_Places_Url() { const string ExpectedUrl = "https://api.twitter.com/1.1/geo/similar_places.json?lat=37.78215&long=-122.4006&name=placeName&contained_within=123&attribute%3Astreet_address=123"; var geoReqProc = new GeoRequestProcessor<Geo>() { BaseUrl = "https://api.twitter.com/1.1/" }; var parameters = new Dictionary<string, string> { {"Type", ((int) GeoType.SimilarPlaces).ToString()}, {"Latitude", (37.78215).ToString()}, {"Longitude", (-122.40060).ToString()}, {"PlaceName", "placeName" }, {"ContainedWithin", "123" }, {"Attribute", "street_address=123" } }; Request req = geoReqProc.BuildUrl(parameters); Assert.Equal(ExpectedUrl, req.FullUrl); }
public void BuildUrl_Constructs_Search_Url() { const string ExpectedUrl = "https://api.twitter.com/1.1/geo/search.json?lat=37.78215&long=-122.4006&query=Twitter%20HQ&ip=168.143.171.180&accuracy=city&granularity=10&max_results=10&contained_within=123&attribute%3Astreet_address=123"; var geoReqProc = new GeoRequestProcessor<Geo>() { BaseUrl = "https://api.twitter.com/1.1/" }; var parameters = new Dictionary<string, string> { {"Type", ((int) GeoType.Search).ToString()}, {"Latitude", (37.78215).ToString()}, {"Longitude", (-122.40060).ToString()}, {"Query", "Twitter HQ" }, {"IP", "168.143.171.180"}, {"Accuracy", "city" }, {"Granularity", "10" }, {"MaxResults", "10" }, {"ContainedWithin", "123" }, {"Attribute", "street_address=123" } }; Request req = geoReqProc.BuildUrl(parameters); Assert.Equal(ExpectedUrl, req.FullUrl); }
public void BuildUrl_Constructs_Reverse_Url() { const string ExpectedUrl = "https://api.twitter.com/1.1/geo/reverse_geocode.json?lat=37.78215&long=-122.4006&accuracy=city&granularity=10&max_results=10"; var geoReqProc = new GeoRequestProcessor<Geo>() { BaseUrl = "https://api.twitter.com/1.1/" }; var parameters = new Dictionary<string, string> { {"Type", ((int) GeoType.Reverse).ToString()}, {"Latitude", "37.78215"}, {"Longitude", "-122.40060"}, {"Accuracy", "city" }, {"Granularity", "10" }, {"MaxResults", "10" } }; Request req = geoReqProc.BuildUrl(parameters); Assert.Equal(ExpectedUrl, req.FullUrl); }
public void BuildUrl_Constructs_ID_Url() { const string ExpectedUrl = "https://api.twitter.com/1.1/geo/id/7695dd2ec2f86f2b.json"; var geoReqProc = new GeoRequestProcessor<Geo>() { BaseUrl = "https://api.twitter.com/1.1/" }; var parameters = new Dictionary<string, string> { {"Type", ((int) GeoType.ID).ToString()}, {"ID", "7695dd2ec2f86f2b"}, }; Request req = geoReqProc.BuildUrl(parameters); Assert.Equal(ExpectedUrl, req.FullUrl); }