Beispiel #1
0
 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 ThermometerController(ILogger <ThermometerController> logger, IThermometerService tempratureService)
 {
     _logger            = logger;
     _tempratureService = tempratureService;
 }
Beispiel #4
0
 public ItemLoggerService(IBbqDataProvider dataProvider, IThermometerService thermometerService)
 {
     this.dataProvider       = dataProvider;
     this.thermometerService = thermometerService;
     this.logDataTimer       = new Timer(this.OnTimerTick);
 }