示例#1
0
 public void TestLoadPastWeatherOnJanuaryAndCheckMaximumTempC()
 {
     using (WeatherWebApi api = new WeatherWebApi())
     {
         IEnumerable <WeatherInfo> infos = api.PastWeather(37.017, -7.933, DateTime.Parse("2019-01-01"), DateTime.Parse("2019-01-30"));
         int max = int.MinValue;
         foreach (WeatherInfo wi in infos)
         {
             if (wi.TempC > max)
             {
                 max = wi.TempC;
             }
         }
         Assert.AreEqual(19, max);
         // Console.WriteLine(String.Join("\n", infos));
     }
 }
 public void ShouldCheckPastWeatherOnJanuaryAndMaximumTempC()
 {
     //Arrange
     using (WeatherWebApi api = new WeatherWebApi())
     {
         IEnumerable <WeatherInfo> infos = api.PastWeather(37.017, -7.933, DateTime.Parse("2019-01-01", CultureInfo.CreateSpecificCulture("pt-PT"), DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeLocal), DateTime.Parse("2019-01-30", CultureInfo.CreateSpecificCulture("pt-PT"), DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeLocal));
         //Act
         int max = int.MinValue;
         foreach (WeatherInfo wi in infos)
         {
             if (wi.TempC > max)
             {
                 max = wi.TempC;
             }
         }
         //Assert
         Assert.AreEqual(19, max);
     }
 }