TestExpandUrl6() { // No such page. Assert.AreEqual("http://www.ThereIsNoSuchAddressAsThis.com", UrlUtil.ExpandUrl("http://www.ThereIsNoSuchAddressAsThis.com")); }
TestExpandUrl5() { // Real page. Assert.AreEqual("http://www.bing.com", UrlUtil.ExpandUrl("http://www.bing.com")); }
GetUrlsFromStatusValueDictionary ( Dictionary <String, Object> statusValueDictionary, Boolean expandUrls ) { Debug.Assert(statusValueDictionary != null); Dictionary <String, Object> entityValueDictionary; if (!TryGetEntityValueDictionary(statusValueDictionary, out entityValueDictionary)) { return(new String[0]); } String [] urls = GetEntities( entityValueDictionary, "urls", "expanded_url", false); if (expandUrls) { Int32 urlCount = urls.Length; for (Int32 i = 0; i < urlCount; i++) { // If there is an (illegal) space in the expanded URL, escape // it to prevent it from causing problems further down the // line. urls[i] = UrlUtil.ExpandUrl(urls[i]).Replace(" ", "%20"); } } return(urls); }
TestExpandUrl10() { // Bad URL found on Twitter on 5/28/2013. const String Url = "twitter.com/nsm"; Assert.AreEqual(Url, UrlUtil.ExpandUrl(Url)); }
TestExpandUrl7() { // Real page, slow. Assert.AreEqual( "https://nodexlgraphgallery.org/Pages/Graph.aspx?graphID=718", UrlUtil.ExpandUrl("http://bit.ly/KFlexu")); }
TestExpandUrl9() { // Real page, Location header is relative URL instead of the required // absolute URL. const String Url = "http://www.marketwatch.com/Story/story/rescue?SourceUrl=http://www.marketwatch.com/story/hispanic-national-bar-association-statement-on-state-of-the-union-address-2012-01-26"; Assert.AreEqual(Url, UrlUtil.ExpandUrl(Url)); }
TestExpandUrl8() { // Repeated calls. for (Int32 i = 0; i < 10; i++) { Assert.AreEqual("http://en.wikipedia.org/wiki/URL_shortening", UrlUtil.ExpandUrl("http://bit.ly/urlwiki")); Assert.AreEqual("http://en.wikipedia.org/wiki/URL_shortening", UrlUtil.ExpandUrl("http://tinyurl.com/urlwiki")); Assert.AreEqual("http://en.wikipedia.org/wiki/URL_shortening", UrlUtil.ExpandUrl("http://is.gd/urlwiki")); Assert.AreEqual("http://en.wikipedia.org/wiki/URL_shortening", UrlUtil.ExpandUrl("http://goo.gl/Gmzqv")); Assert.AreEqual("http://www.bing.com", UrlUtil.ExpandUrl("http://www.bing.com")); } }
TestExpandUrl2() { Assert.AreEqual("http://en.wikipedia.org/wiki/URL_shortening", UrlUtil.ExpandUrl("http://tinyurl.com/urlwiki")); }
TestExpandUrl() { Assert.AreEqual("http://en.wikipedia.org/wiki/URL_shortening", UrlUtil.ExpandUrl("http://bit.ly/urlwiki")); }
TestExpandUrl4() { Assert.AreEqual("http://en.wikipedia.org/wiki/URL_shortening", UrlUtil.ExpandUrl("http://goo.gl/Gmzqv")); }