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

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

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

            builder.SetMinTemperature((float)dynamicObject.min_temp, TemperatureScale.Celsius)
            .SetMaxTemperature((float)dynamicObject.max_temp, TemperatureScale.Celsius)
            .SetWeatherCode((int)dynamicObject.weather.code)
            .SetWeatherDescription((string)dynamicObject.weather.description)
            .SetChanceOfRain((int)dynamicObject.pop)
            .SetWindSpeed((float)dynamicObject.wind_spd, WindSpeedUnit.MetersPerSecond)
            .SetPressure((int)dynamicObject.slp)
            .SetDate(DateTime.Parse((string)dynamicObject.datetime));
            return(builder.Build());
        }
Exemple #3
0
        protected override WeatherData BuildWeatherDataFromDynamicObject(dynamic dynamicObject)
        {
            var builder = new WeatherDataBuilder();

            builder
            .SetMinTemperature((float)dynamicObject.temp.min, TemperatureScale.Celsius)
            .SetMaxTemperature((float)dynamicObject.temp.max, TemperatureScale.Celsius)
            .SetChanceOfRain((int)((float)dynamicObject.pop * 100))
            .SetWeatherCode((int)dynamicObject.weather[0].id)
            .SetWeatherDescription((string)dynamicObject.weather[0].description)
            .SetWindSpeed((float)dynamicObject.wind_speed, WindSpeedUnit.MetersPerSecond)
            .SetWindDirection((int)dynamicObject.wind_deg)
            .SetDate(GetDateTimeFromUnixTimeStamp((long)dynamicObject.dt));

            return(builder.Build());
        }