public void NwsLoader_LoadPoint1_EverythingIsFine() { // Arrange var nwsDataLoader = A.Fake <INwsDataLoader>(); A.CallTo(() => nwsDataLoader.GetResponseStream("/points/43.05,-89.52")) .Returns(File.Open("./TestResponses/nwsPoint.json", FileMode.Open)); var nwsLoader = new NwsLoader(nwsDataLoader); NwsPoint actual = null; // Act actual = nwsLoader.PointData(43.05, -89.52); // Assert // Don't test everything since there's a lot of data and typing Assert.Equal("MKX", actual.CountyWarningArea); Assert.Equal(new Uri("https://api.weather.gov/offices/MKX"), actual.ForecastOffice); Assert.Equal(33, actual.GridX); Assert.Equal(30, actual.GridY); Assert.Equal(new Uri("https://api.weather.gov/gridpoints/MKX/33,30/forecast"), actual.Forecast); Assert.Equal(new Uri("https://api.weather.gov/gridpoints/MKX/33,30/forecast/hourly"), actual.ForecastHourly); Assert.Equal(new Uri("https://api.weather.gov/gridpoints/MKX/33,30"), actual.ForecastGridData); Assert.Equal(new Uri("https://api.weather.gov/gridpoints/MKX/33,30/stations"), actual.ObservationStations); Assert.Equal("Middleton", actual.RelativeLocation.City); Assert.Equal("WI", actual.RelativeLocation.State); Assert.Equal(new Uri("https://api.weather.gov/zones/forecast/WIZ063"), actual.ForecastZone); Assert.Equal(new Uri("https://api.weather.gov/zones/county/WIC025"), actual.County); Assert.Equal(new Uri("https://api.weather.gov/zones/fire/WIZ063"), actual.FireWeatherZone); Assert.Equal("America/Chicago", actual.TimeZone); Assert.Equal("KMKX", actual.RadarStation); }
/// <summary> /// Wrapper for /points/{latitude,longitude}/forecast /// /// https://forecast-v3.weather.gov/documentation /// </summary> /// <param name="nwsPoint">Point specifying the location</param> /// <returns>NwsPointForecast containing forecast information for the specified point</returns> /// <exception cref="NotImplementedException"></exception> public NwsPointForecast PointForecast(NwsPoint nwsPoint) { throw new NotImplementedException(nameof(PointForecast) + " not implemented"); }
/// <summary> /// Wrapper for /points/{latitude,longitude}/stations /// /// https://forecast-v3.weather.gov/documentation /// </summary> /// <param name="nwsPoint">Point specifying the location</param> /// <returns>NwsPointStations containing nearby station information for the specified point</returns> /// <exception cref="NotImplementedException"></exception> public NwsPointStations PointStations(NwsPoint nwsPoint) { throw new NotImplementedException(nameof(PointStations) + " not implemented"); }