public RecommendationValue(DateTime startTime, DateTime endTime, OutreachType outreachType, WeatherDataValue weatherDataValue) { StartTime = startTime; EndTime = endTime; RecommendedOutreachCode = outreachType; Weather = weatherDataValue ?? throw new ArgumentNullException(nameof(Weather));; }
public WeatherDataBuilder WithSunnyWeather() { weatherDataValue = new WeatherDataValue(weatherDataValue.StartDate, weatherDataValue.EndDate, weatherDataValue.Temperature, weatherDataValue.TemperatureHigh, weatherDataValue.TemperatureLow, 0, 0); return(this); }
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); }
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); }
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)); } }
private static RecommendationValue Build(WeatherDataValue weatherData, OutreachType outreachType) => new RecommendationValue(weatherData.StartDate, weatherData.EndDate, outreachType, weatherData);