private void TitleAssertRemoves(string dirtyTitle, string[] removedStrings) { string cleanTitle = new TitleCleaner().Clean(dirtyTitle); foreach (string badString in removedStrings) { AssertDoesNotContain(cleanTitle, badString); } }
public LookupContext Search(string title) { string clean_title = new TitleCleaner().Clean(title); string queryUrl = @"http://www.myapifilms.com/title?limit=10&title=" + clean_title; string response = "No Response"; try { response = httpService.Get(queryUrl); JArray objects = JArray.Parse(response); var results = objects.Select(o => parseOne(o, title)).OrderBy(r => -r.SearchScore); return new LookupContext(results.ToList<LookupResult>(), title); } catch (JsonReaderException e) { return new LookupContext(new List<LookupResult>(), title, e, queryUrl, response); } catch (System.Net.WebException e) { return new LookupContext(new List<LookupResult>(), title, e, queryUrl, response); } }
public LookupContext Search(string title) { string clean_title = new TitleCleaner().Clean(title); string queryUrl = @"http://www.myapifilms.com/title?limit=10&title=" + clean_title; string response = "No Response"; try { response = httpService.Get(queryUrl); JArray objects = JArray.Parse(response); var results = objects.Select(o => parseOne(o, title)).OrderBy(r => - r.SearchScore); return(new LookupContext(results.ToList <LookupResult>(), title)); } catch (JsonReaderException e) { return(new LookupContext(new List <LookupResult>(), title, e, queryUrl, response)); } catch (System.Net.WebException e) { return(new LookupContext(new List <LookupResult>(), title, e, queryUrl, response)); } }
private void TitleAssertRemoves(string dirtyTitle, string removedString) { string cleanTitle = new TitleCleaner().Clean(dirtyTitle); AssertDoesNotContain(cleanTitle, removedString); }
private void TitleAssertContains(string dirtyTitle, string cleanSubstring) { string cleanTitle = new TitleCleaner().Clean(dirtyTitle); StringAssert.Contains(cleanTitle, cleanSubstring); }
public void It_should_clean_up_anything_following_the_year_or_resolution_and_trailing_whitespace() { string cleanTitle = new TitleCleaner().Clean("Dawn_Of_The_Planet_Of_The_Apes_2014_Trailer_B_5.1-1080p-HDTN.mp4"); Assert.AreEqual<string>(cleanTitle, "Dawn Of The Planet Of The Apes"); }