public void escaped_symbols_are_replaced_with_double_backslash() { const string urlEncodedTitle = @"a title with-escaped symbols ?!%^&*()/\\"; var result = PathwayTitleUriParser.EscapeSymbols(urlEncodedTitle); Assert.AreEqual(@"a title with-escaped symbols \\?\\!\\%\\^\\&\\*\\(\\)\\/\\\\\\", result); }
public void escaped_dashes_are_not_replaced_with_a_space() { const string urlEncodedTitle = "a-title-with-an-es--caped-dash"; var result = PathwayTitleUriParser.Parse(Uri.EscapeUriString(urlEncodedTitle)); Assert.AreEqual("a title with an es-caped dash", result); }
public void all_dashes_in_title_replaced_with_spaces() { const string title = "a-title-with-lots-of-dashes-in-it"; var result = PathwayTitleUriParser.Parse(title); Assert.AreEqual("a title with lots of dashes in it", result); }
public void all_url_encoded_spaces_replaces_with_spaces() { const string urlEncodedTitle = "a title with lots of spaces"; var result = PathwayTitleUriParser.Parse(Uri.EscapeUriString(urlEncodedTitle)); Assert.AreEqual(urlEncodedTitle, result); }
public async Task <string> GetPathwaysNumbers(string pathwayTitle) { var pathwayNumberList = await _graphRepository.Client.Cypher .Match("(p:Pathway)") .Where(string.Format("p.title =~ \"(?i){0}\"", PathwayTitleUriParser.EscapeSymbols(pathwayTitle)), UseWhitelist) //case-insensitive query .Return(p => Return.As <string>("p.pathwayNo")) .ResultsAsync; var pathwayNumbers = pathwayNumberList as string[] ?? pathwayNumberList.ToArray(); return(!pathwayNumbers.Any() ? string.Empty : string.Join(",", pathwayNumbers.Distinct())); }