public void RiverExtensions_DoesReturnDataArray() { var river = new River(); var array = river.PopulateRiverData(); Assert.NotNull(array); }
public async Task <River> GetRiverDetailsAsync(string riverCode) { var river = new River(); HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, _usgsUrl + riverCode + "&period=P1D¶meterCd=00065,00060&siteStatus=all"); using (HttpResponseMessage outstuff = await _client.SendAsync(request)) { var vals = await outstuff.Content.ReadAsStringAsync(); USGSRiverResponse obj = JsonConvert.DeserializeObject <USGSRiverResponse>(vals); if (obj.Value.TimeSeries.Length > 0) { river = new River() { Name = obj.Value.TimeSeries[0].SourceInfo.SiteName, Latitude = obj.Value.TimeSeries[0].SourceInfo.Geolocation.GeogLocation.Latitude, Longitude = obj.Value.TimeSeries[0].SourceInfo.Geolocation.GeogLocation.Longitude, Srs = obj.Value.TimeSeries[0].SourceInfo.Geolocation.GeogLocation.SRS, RiverId = obj.Value.TimeSeries[0].SourceInfo.SiteCode[0].Value }; river.Flow = obj.ParseTimeSeriesData(TimeSeriesTypes.CubicFeet); river.Levels = obj.ParseTimeSeriesData(TimeSeriesTypes.GuageHeight); river.RiverData = river.PopulateRiverData(); } return(river); } }