コード例 #1
0
        public void AcceptancePolandWarsawTest()
        {
            var service  = new OpenWeatherMapService();
            var response = service.GetWeatherForecastAsync(new Services.Models.WeatherForecastRequest
            {
                Configuration = new Services.Models.ApiConfiguration
                {
                    ApiKey = "ffa42a7152fe42b4afb5139e65b3c6d7"
                },
                Location = new Services.Models.Location
                {
                    City    = "Warsaw",
                    Country = "Poland"
                }
            }).Result;

            Assert.NotNull(response);
            Assert.NotNull(response.Location);
            Assert.NotNull(response.Tempreature);
            Assert.Equal("warsaw", response.Location.City.ToLower());
            Assert.Equal("poland", response.Location.Country.ToLower());
            Assert.Equal("celsius", response.Tempreature.Format.ToLower());
            Assert.NotEqual(0, response.Tempreature.Value);
            Assert.NotEqual(0, response.Humidity);
        }
コード例 #2
0
        public void TempratreAndHumidityTest()
        {
            var service  = new OpenWeatherMapService();
            var response = service.GetWeatherForecastAsync(new Services.Models.WeatherForecastRequest
            {
                Configuration = new Services.Models.ApiConfiguration
                {
                    ApiKey = "ffa42a7152fe42b4afb5139e65b3c6d7"
                },
                Location = new Services.Models.Location
                {
                    City    = "London",
                    Country = "United Kingdom"
                }
            }).Result;

            Assert.NotNull(response);
            Assert.NotNull(response.Location);
            Assert.NotNull(response.Tempreature);
            Assert.Equal("london", response.Location.City.ToLower());
            Assert.Equal("united kingdom", response.Location.Country.ToLower());
            Assert.Equal("celsius", response.Tempreature.Format.ToLower());
            Assert.NotEqual(0, response.Tempreature.Value);
            Assert.NotEqual(0, response.Humidity);
        }