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); }
static void Main(string[] args) { var nwsDataLoader = new NwsDataLoader(new HttpClient(), "NwsApiTestbench"); var loader = new NwsLoader(nwsDataLoader); var data = loader.PointData(43.05, -89.52); Console.ReadLine(); }