public async Task LocationSuggest() { var query = "e15 1"; var mockApi = new Mock <ISearchAndCompareApi>(); var geocoderApi = new Mock <IGeocoder>(); geocoderApi.Setup(x => x.SuggestLocationsAsync(query)) .ReturnsAsync(new List <string>() { query }); var controller = new DynamicController(mockApi.Object, geocoderApi.Object, TelemetryClientHelper.GetMocked()); var res = await controller.LocationSuggest(query); var jsonResult = res as JsonResult; Assert.IsNotNull(jsonResult); Assert.IsNotNull(jsonResult.Value); var jsonResultValue = jsonResult.Value as List <string>; Assert.IsNotNull(jsonResultValue); CollectionAssert.IsNotEmpty(jsonResultValue); Assert.AreEqual(query, jsonResultValue[0]); Assert.AreEqual(1, jsonResultValue.Count); }