public void GenerateInvalidUrlWithFormatException() { var opt = new BingSearchOption() { BaseUrl = "https://api.cognitive.microsoft.com/bing/v7.0/search?q={", Key = "key" }; var bse = new BingSearchEngine(opt); Assert.Throws <FormatException>(() => bse.GetFormattedSearchUrl(null)); }
public void GenerateValidUrl() { var opt = new BingSearchOption() { BaseUrl = "https://api.cognitive.microsoft.com/bing/v7.0/search?q={0}", Key = "key" }; var bse = new BingSearchEngine(opt); var searchText = "Привет"; var url = bse.GetFormattedSearchUrl(searchText); Assert.True(!string.IsNullOrWhiteSpace(url), "url is null or whitespace"); }