public void Api_Submit_ValidLocationRequest_ReturnsCorrectWoeid(string cityName, int expectedCount, int expectedWoeid, ApiProxy apiProxy, ILocationRequest locationRequest, ILocationResponse locationResponse) { $"Given a cityName value of {cityName}" .x(() => locationRequest = new LocationRequest { CityName = cityName }); "And an ApiProxy" .x(() => apiProxy = new ApiProxy(_metaWeatherService)); "When the location request is submitted" .x(async() => locationResponse = await apiProxy.SubmitLocationRequest(locationRequest).ConfigureAwait(false)); $"Then the location response should return HttpStatusCode.OK), CityName {cityName} and WoeId {expectedWoeid}" .x(() => { using (new AssertionScope()) { locationResponse.StatusCode.Should().Be(HttpStatusCode.OK); locationResponse.Locations.Should().HaveCount(expectedCount); locationResponse.Locations[0].WoeId.Should().Be(expectedWoeid); } }); }
public void Api_Submit_InvalidLocationRequest_ReturnsNotFound(string cityName, ApiProxy apiProxy, ILocationRequest locationRequest, ILocationResponse locationResponse) { $"Given a cityName value of {cityName}" .x(() => locationRequest = new LocationRequest { CityName = cityName }); "And an ApiProxy".x(() => apiProxy = new ApiProxy(_metaWeatherService)); "When the location request is submitted" .x(async() => locationResponse = await apiProxy.SubmitLocationRequest(locationRequest).ConfigureAwait(false)); "Then the location response should return HttpStatusCode.NotFound, and Locations should be empty" .x(() => { using (new AssertionScope()) { locationResponse.StatusCode.Should().Be(HttpStatusCode.NotFound); locationResponse.Locations.Should().BeNullOrEmpty(); } }); }
public async Task <IEnumerable <Station> > GetNearestStations() { ILocationResponse location = await _locationProvider.GetPositionAsync(); return(location is GeoLocation ? await GetNearestStationsTo(location as GeoLocation) : Enumerable.Empty <Station>()); }
public LocationController(ISpotUser user, ILocation location, IAtomicLocationWork atomicWork, ILocationResponse response, ILocationFacade locationFacade) { _user = user; _location = location; _atomicWork = atomicWork; _response = response; _locationFacade = locationFacade; }
private async Task AddLocationToIssue(ReportedIssue issue) { ILocationResponse location = await _locationProvider.GetPositionAsync(); if (location is GeoLocation) { var geoLocation = location as GeoLocation; issue.Latitude = geoLocation.Latitude; issue.Longitude = geoLocation.Longitude; } }