public ThermalNotifierServiceTest() { _logger = A.Fake<ILogger>(); _thermometerService = A.Fake<IThermometerService>(); _slackNotifierService = A.Fake<ISlackNotifierService>(); _configuration = A.Fake<IConfiguration>(); _thermalNotifierService = new ThermalNotifierService(_thermometerService, _slackNotifierService, _configuration, _logger); ThermalNotifierServiceTemperatureHistory.LastKnownTemperature = null; }
public ThermalNotifierService(IThermometerService thermometerService, ISlackNotifierService slackNotifierService, IConfiguration configuration, ILogger logger) { _thermometerService = thermometerService; _slackNotifierService = slackNotifierService; if (double.TryParse(configuration["MinTemperature"], out double minTemperature)) { MinTemperature = minTemperature; } if (double.TryParse(configuration["MaxTemperature"], out double maxTemperature)) { MaxTemperature = maxTemperature; } if (double.TryParse(configuration["BufferTemperature"], out double bufferTemperature)) { BufferTemperature = bufferTemperature; } if (!string.IsNullOrWhiteSpace(configuration["SlackEndpoint"])) { SlackEndpoint = configuration["SlackEndpoint"]; } if (int.TryParse(configuration["ForceReminderTimeWhenOutOfRange"], out int forceReminderTimeWhenOutOfRange)) { ForceReminderTimeWhenOutOfRange = forceReminderTimeWhenOutOfRange; } if (int.TryParse(configuration["ForceReminderTimeWhenInRange"], out int forceReminderTimeWhenInRange)) { ForceReminderTimeWhenInRange = forceReminderTimeWhenInRange; } _logger = logger; }
public SlackNotifierController(ILogger <SlackNotifierController> logger, ISlackNotifierService slackNotifierService) { _logger = logger; _slackNotifierService = slackNotifierService; }