Ejemplo n.º 1
0
 public RecommendationValue(DateTime startTime,
                            DateTime endTime,
                            OutreachType outreachType,
                            WeatherDataValue weatherDataValue)
 {
     StartTime = startTime;
     EndTime   = endTime;
     RecommendedOutreachCode = outreachType;
     Weather = weatherDataValue ?? throw new ArgumentNullException(nameof(Weather));;
 }
Ejemplo n.º 2
0
        public WeatherDataBuilder WithSunnyWeather()
        {
            weatherDataValue = new WeatherDataValue(weatherDataValue.StartDate,
                                                    weatherDataValue.EndDate,
                                                    weatherDataValue.Temperature,
                                                    weatherDataValue.TemperatureHigh,
                                                    weatherDataValue.TemperatureLow,
                                                    0,
                                                    0);

            return(this);
        }
Ejemplo n.º 3
0
        public WeatherDataBuilder WithWarmWeather()
        {
            weatherDataValue = new WeatherDataValue(weatherDataValue.StartDate,
                                                    weatherDataValue.EndDate,
                                                    new TemperatureValue(300),
                                                    new TemperatureValue(301),
                                                    new TemperatureValue(299),
                                                    weatherDataValue.RainChance,
                                                    weatherDataValue.CloudCoverPercentage);

            return(this);
        }
Ejemplo n.º 4
0
        private WeatherDataBuilder()
        {
            var startTime = DateTime.UtcNow;
            var endTime   = startTime.AddHours(3);

            // TODO - Add utility code to actually randomize these
            var lowTemp        = new TemperatureValue(270.0);
            var temp           = new TemperatureValue(274.0);
            var highTemp       = new TemperatureValue(275.0);
            var rainChance     = 4;
            var cloudCoverPerc = 20;

            weatherDataValue = new WeatherDataValue(startTime,
                                                    endTime,
                                                    temp,
                                                    highTemp,
                                                    lowTemp,
                                                    rainChance,
                                                    cloudCoverPerc);
        }
Ejemplo n.º 5
0
        public RecommendationValue Create(WeatherDataValue weatherDataValue)
        {
            if (weatherDataValue == null)
            {
                throw new ArgumentNullException(nameof(weatherDataValue));
            }

            switch (weatherDataValue)
            {
            case WeatherDataValue w when w.IsSunny && w.IsWarm && !w.IsRaining:
                return(Build(w, OutreachType.TextMessage));

            case WeatherDataValue w when w.IsMild:
                return(Build(w, OutreachType.Email));

            case WeatherDataValue w when w.IsRaining || w.IsCold:
                return(Build(w, OutreachType.PhoneCall));

            default:
                return(Build(weatherDataValue, OutreachType.DoNotContact));
            }
        }
Ejemplo n.º 6
0
 private static RecommendationValue Build(WeatherDataValue weatherData, OutreachType outreachType)
 => new RecommendationValue(weatherData.StartDate, weatherData.EndDate, outreachType, weatherData);