Exemple #1
0
        public void SetApparentTemperature_ProperlySetsValue(float input, float expectedValue, TemperatureScale unit)
        {
            var builder = new WeatherDataBuilder();

            builder.SetApparentTemperature(input, unit);
            var data = builder.Build();

            Assert.Equal(expectedValue, data.TemperatureApparent.Value);
        }
Exemple #2
0
        protected override WeatherData BuildWeatherDataFromDynamicObject(dynamic dynamicObject)
        {
            var builder = new WeatherDataBuilder();

            builder
            .SetApparentTemperature((float)dynamicObject.feels_like, TemperatureScale.Celsius)
            .SetTemperature((float)dynamicObject.temp, TemperatureScale.Celsius)
            .SetHumidity((int)dynamicObject.humidity)
            .SetPressure((int)dynamicObject.pressure)
            .SetDate(GetLocalDateTimeFromResponse((object)dynamicObject))
            .SetChanceOfRain((int)((float)dynamicObject.pop * 100))
            .SetWindSpeed((float)dynamicObject.wind_speed, WindSpeedUnit.MetersPerSecond)
            .SetWindDirection((int)dynamicObject.wind_deg)
            .SetWeatherCode((int)dynamicObject.weather[0].id)
            .SetWeatherDescription((string)dynamicObject.weather[0].description);
            return(builder.Build());
        }