public void ExtractDisplayTextFromWikiLink_wikiLinkWithDislayValue_returnsExpectedResult() { const string wikiLink = "[[foo|bar]]"; var result = InternalWikiLinkParser.ExtractDisplayTextFromLink(wikiLink); Assert.AreEqual("bar", result); }
public void ExtractDisplayTextFromWikiLink_wikiLinkWithTextImmediateAfter_returnsExpectedResult() { const string wikiLink = @"[[3D Realms|Apogee Software]]{{efn|The game was published by [[Manaccom]] in Austrlia, the 3DO version was published by [[Interplay Entertainment]], the Atari Jaguar version was published by [[Atari Corporation]], the Game Boy Advance version was published by [[BAM! Entertainment]], the Macistosh version was published by [[MacPlay]], the game was also published by [[GT Interactive]] in 1993, Zodttd on iOS and by [[Activision]] on Xbox Live Arcade and PlayStation Network.}}"; var result = InternalWikiLinkParser.ExtractDisplayTextFromLink(wikiLink); Assert.AreEqual("Apogee Software", result); }
private static void Main(string[] args) { const string pageId = "100062"; Console.WriteLine("Fetching url for pageId " + pageId + "..."); string url = PageIdService.GetWikipediaUrlForPageId(pageId); Console.WriteLine("Url is: " + url); Console.WriteLine(); const string testWikipediaUrl = "https://en.wikipedia.org/wiki/Namco_Museum_Volume_1"; Console.WriteLine("Fetching redirect url for " + testWikipediaUrl + "..."); string destinationUrl = UrlRedirectService.GetRedirectUrlForWikipediaUrl(testWikipediaUrl); Console.WriteLine("Destination url is: " + destinationUrl); Console.WriteLine(); Console.WriteLine("Fetching image urls for " + url + "..."); List <string> imageUrls = ImageService.GetImageUrlsForWikipediaUrl(url); Console.WriteLine("Images found:"); imageUrls.ForEach(u => Console.WriteLine(" " + u)); Console.WriteLine(); Console.WriteLine("Fetching InfoBox test for " + url + "..."); string infoBoxText = InfoBoxService.GetInfoBoxTextForWikipediaUrl(url); Console.WriteLine("InfoBox text: " + infoBoxText); Console.WriteLine(); Console.WriteLine("Getting title for InfoBox text... "); Console.WriteLine("Title is " + InfoBoxWikiTextParser.GetTitleForInfoBox(infoBoxText)); Console.WriteLine(); Console.WriteLine("Getting genre from InfoBox text... "); string genre = InfoBoxWikiTextParser.GetNamedElementFromInfoBox(infoBoxText, "genre"); Console.WriteLine("Genre is " + genre); Console.WriteLine(); Console.WriteLine("Getting display text for genre..."); Console.WriteLine(genre + " => " + InternalWikiLinkParser.ExtractDisplayTextFromLink(genre)); }
public void ExtractDisplayTextFromWikiLink_noWikiLink_returnEmptyString() { var result = InternalWikiLinkParser.ExtractDisplayTextFromLink("hello"); Assert.AreEqual("", result); }
public void ExtractDisplayTextFromWikiLink_notAWikiLink_returnEmptyString() { var result = InternalWikiLinkParser.ExtractDisplayTextFromLink("Bally Midway <br> [[Atari]] '''(Atari 2600, 7800 and Atatri ST)''' <br> SunSoft '''(NES)''' <br> Others"); Assert.AreEqual("", result); }