public async Task <GoogleDataObject> SearchForLocation(string location, string type = null) { var result = await googleService.LocationFromLandmark(location); if (result == null) { throw new ArgumentException("There wasn't a match for this search location"); } try { var resultUser = await CheckIfAlreadyInWishlist(result); if (resultUser.Item2.Suggestions == true) { await AddKeyword(location, result); } return(resultUser.Item1); } catch (Exception) { // Person is a guest // Person isn't a guest, but the keyword already exists in the database } return(result); }
public async Task LocationFromLandmark() { // Inject // Arrange //var expected = new GoogleDataObject() { City = "Burgas", Country = "Bulgaria", CountryCode = "BG", Latitude = 42.5138584, Longitude = 27.469502, PlaceId = "ChIJc-mFqIaUpkARt2OCHhOpfk4" }; // Act //var types = new string[2] { "airport", "park" }; var result = await service.LocationFromLandmark("НЕГ Гьоте"); // Assert Assert.Equal(typeof(GoogleDataObject), result.GetType()); }