public async Task <Result <string[]> > Typeahead(string term, TypeaheadOptions options = default, AccessToken accessToken = default, CancellationToken cancellationToken = default) { options = options ?? new TypeaheadOptions(); var path = GetPath(term); var requestUri = GetUri(path); return(await HttpPost <string[]>(requestUri, data : options, administrationOrApiKey : AddressLookupKey, token : accessToken, cancellationToken : cancellationToken)); }
public async Task Given_Top_Equals_1_Typeahead_Returns_1_Result() { var api = Helpers.ApiHelper.GetApi(); var options = new TypeaheadOptions { Top = 1 }; var result = await api.Typeahead("PE", options : options); result.IsSuccess.ShouldBeTrue(); result.Success.Length.ShouldBe(1); }
public async Task Given_Filter_County_As_Cambs_And_Cambs_Postcode_Typeahead_Returns_multiple_Results() { var api = Helpers.ApiHelper.GetApi(); var options = new TypeaheadOptions { }; options.Filter.County = "Cambridgeshire"; var result = await api.Typeahead("PE15", options : options); result.IsSuccess.ShouldBeTrue(); result.Success.Length.ShouldBeGreaterThan(0); }
public async Task Given_Filter_County_As_Northamptonshire_And_Cambs_Postcode_Typeahead_Returns_0_Results() { var api = Helpers.ApiHelper.GetApi(); var options = new TypeaheadOptions { }; options.Filter.County = "Northamptonshire"; var result = await api.Typeahead("PE10", options : options); result.IsSuccess.ShouldBeTrue(); result.Success.Length.ShouldBe(0); }