public void ExtractValueForInfoBoxKey_multiLineWithTemplates_extractsExpectedValue() { string extractedValue = InfoBoxWikiTextParser.GetNamedElementFromInfoBox(sampleWikiText, "publisher"); const string expectedValue = @"; Mega Drive: {{vgrelease|JP=[[HOT・B]]|NA=[[Flying Edge]]|EU=[[Flying Edge]] <small>(as ''Empire of Steel'')</small>}} ; Game Boy Advance: {{vgrelease|JP=[[Starfish(company)|Starfish]]|EU=[[Zushi Games|Zoo Digital Publishing]]}} ; Nintendo 3DS: {{vgrelease|JP=Starfish SD|NA=[[Teyon]]}}"; Assert.AreEqual(expectedValue, extractedValue); }
public void ExtractValueForInfoBoxKey_multiLineWithPlainListTemplate_extractsExpectedValue() { string extractedValue = InfoBoxWikiTextParser.GetNamedElementFromInfoBox(sampleWikiText, "designer"); const string expectedValue = @"{{plainlist| * [[Atari]] ([[Atari Lynx]]) * [[U.S. Gold]] ([[Atari ST]], [[Amiga]], [[ZX Spectrum]]) * [[Epyx]] ([[MS-DOS]]) * [[Microsoft Home]] ([[Microsoft Windows|Windows]]) }}"; Assert.AreEqual(expectedValue, extractedValue); }
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 ExtractValueForInfoBoxKey_multiLineWithTemplates2_extractsExpectedValue() { const string expectedValue = @"{{Collapsible list | titlestyle = font-weight:normal;background:transparent;text-align:left; | {{Video game release|EU=[[Infogrames]]}} | {{Video game release|EU=[[Mirrorsoft]] {{small|(Home Computers)}}}} | {{Video game release|[[Europe|EU]]/[[North America|NA]]|[[Nintendo]] {{small|(NES)}}}} | {{Video game release|[[Europe|EU]]/[[North America|NA]]|[[Philips]]}} | {{Video game release|NA|AcademySoft {{small|(MS-DOS)}}}} | {{Video game release|NA|[[Spectrum HoloByte]]}} | {{Video game release|NA|[[Tandy Computers|Tandy]]}} | {{Video game release|JP|[[Bullet Proof Software]] {{small|(Home computers)}}}} | {{Video game release|JP|[[Sega]] {{small|(AC/MD)}}}} | {{Video game release|JP|[[W!Games]]}} | {{Video game release|Korea|KR|DR Korea {{small|(AC)}}}} }}"; string extractedValue = InfoBoxWikiTextParser.GetNamedElementFromInfoBox(sampleWikiText, "distributor"); Assert.AreEqual(expectedValue, extractedValue); }
public void ExtractValueForInfoBoxKey_singleLineWithWikiLink_extractsExpectedValue() { string extractedValue = InfoBoxWikiTextParser.GetNamedElementFromInfoBox(sampleWikiText, "developer"); Assert.AreEqual("[[HOT・B]]<br />Mebius(3DS)", extractedValue); }
public void ExtractValueForInfoBoxKey_singleLineWithTemplate_extractsExpectedValue() { string extractedValue = InfoBoxWikiTextParser.GetNamedElementFromInfoBox(sampleWikiText, "released"); Assert.AreEqual("{{vgrelease|JP=March 13, 1992|NA=1992|PAL=1992}}", extractedValue); }
public void ExtractValueForInfoBoxKey_singleLineWithNoTemplate_extractsExpectedValue() { string extractedValue = InfoBoxWikiTextParser.GetNamedElementFromInfoBox(sampleWikiText, "caption"); Assert.AreEqual("''Steel Empire'' Genesis box art", extractedValue); }
public void ExtractValueForInfoBoxKey_keyHasNoValue_returnsEmptyString() { string extractedValue = InfoBoxWikiTextParser.GetNamedElementFromInfoBox(sampleWikiText, "image"); Assert.AreEqual("", extractedValue); }