public void GetAPIKeyShouldReturnCorrectKey() { //Arrange OpenWeaherAPI api = new OpenWeaherAPI(); //Act string currentKey = api.GetAPIKey(); //Assert Assert.NotNull(currentKey); }
public void SetAPIKeyShouldChangeKey(string key) { //Arrange OpenWeaherAPI api = new OpenWeaherAPI(); string currentKey = api.GetAPIKey(); Assert.NotSame(currentKey, key); //Act api.SetAPIKey(key); //Assert currentKey = api.GetAPIKey(); Assert.Equal(currentKey, key); }
private async Task <List <Forecast> > LoadDataFromWebservice(List <City> observedCities) { List <Forecast> forecastDTOs = new List <Forecast>(); Forecast forecastDTO; OpenWeaherAPI openWeaher = new OpenWeaherAPI(); foreach (var city in observedCities) { try { forecastDTO = await openWeaher.GetForecast(city.ServiceId); } catch (Exception) { logger.WriteMessage("Failed to get a forecast from webservice."); continue; } forecastDTOs.Add(forecastDTO); } return(forecastDTOs); }