/// <summary> /// Return a list of address records matching the supplied search term. /// </summary> /// <param name="searchTerm">A search term representing part of an address (e.g. "WR5", "Postcode Anywhere", "Basin Road").</param> /// <param name="lastId">An ID from a previous Find operation.</param> /// <param name="searchFor">A <see cref="SearchFor"/> value specifying which properties of address records to search against.</param> /// <param name="country">The ISO code for the country to search (e.g. "GB").</param> /// <param name="languagePreference">The language identifier code for the search result language (e.g. "EN").</param> /// <param name="maxSuggestions">The maximum number of autocomplete suggestions to return.</param> /// <param name="maxResults">The maximum number of retrievable address results to return.</param> /// <returns>A <see cref="CapturePlusFindResult"/> containing a list of results or error information.</returns> public CapturePlusFindResult Find(string searchTerm, string lastId, SearchFor searchFor, string country, string languagePreference, int?maxSuggestions, int?maxResults) { var url = string.Format(_FIND_URL, _apiVersion); var req = new RestRequest(url, Method.GET); req.AddParameter("Key", _key); req.AddParameter("SearchTerm", searchTerm); // TODO: I don't yet understand how the LastId parameter is used... // The docs say 'If the LastId is provided, the SearchTerm searches within the results from the LastId', // but the IDs are unique, so you would only ever be searching within a single result? req.AddParameter("LastId", lastId ?? ""); req.AddParameter("SearchFor", searchFor.ToString()); req.AddParameter("Country", country); req.AddParameter("LanguagePreference", languagePreference); req.AddParameter("MaxSuggestions", maxSuggestions.HasValue ? maxSuggestions.Value.ToString() : ""); req.AddParameter("MaxResults", maxResults.HasValue ? maxResults.Value.ToString() : ""); var resp = _client.Execute <CapturePlusFindResultList>(req); var result = resp.Data.Items; if (result.IsError()) { return(new CapturePlusFindResult(result.MapError())); } else { return(new CapturePlusFindResult(result.MapResults())); } }
public void SearchBooks_PicksUpProperMenuCase(SearchFor menuItem) { _menuHelper.Setup(m => m.DoSearchMenuSelection()).Returns(menuItem); _search.SearchBooks(); _screenHelper.Verify(s => s.ReadInputString(menuItem.ToString()), Times.Once); }