public async Task Given_file_exists_then_returns_saved_values() { // Given var savedConfig = new WarmupEffectConfig { UseMaxTemp = 123 }; await _sut.SaveConfig(savedConfig); // When var loadedConfig = await _sut.LoadConfig <WarmupEffectConfig>(); // Then Assert.NotNull(loadedConfig); Assert.Equal(savedConfig.UseMaxTemp, loadedConfig.UseMaxTemp); }
public async Task Given_file_does_not_exist_then_returns_default_values() { // Given var fileName = Path.Combine(_testPath, nameof(WarmupEffectConfig) + ".json"); if (File.Exists(fileName)) { File.Delete(fileName); } // When var config = await _sut.LoadConfig <WarmupEffectConfig>(); // Then var defaultConfig = new WarmupEffectConfig(); Assert.NotNull(config); Assert.Equal(defaultConfig.UseMaxTemp, config.UseMaxTemp); }
public WarmupHandler(WarmupEffectConfig config, ILoggerFactory loggerFactory, ILocalHueClient hueClient) : base(hueClient, loggerFactory) { _config = config; _logger = loggerFactory.CreateLogger <WarmupHandler>(); }