public async Task Search_NotFound_ReturnsEmpty() { var results = await _valueService.Search("NOT EXIST"); Assert.IsNotNull(results); Assert.IsTrue((results as List <IValueModel>).Count == 0); }
public async Task <IActionResult> Get([FromQuery, Required] SearchOptions searchOptions) { // Dummy search results - this would normally be replaced by another service call, perhaps to a database var searchResults = await _valueService.Search(searchOptions.Name); var formattedResult = JsonConvert.SerializeObject(searchResults, Formatting.Indented); Response.Headers.Add("x-total-count", searchResults.Count.ToString()); return(Ok(formattedResult)); }