public void Battery_entities_existing_entries_are_retained()
        {
            // Arrange
            var filesystem  = new DummyFilesystem();
            var transformer = new LovelaceConfigTransformer(new DeviceTranslator());
            var generator   = new LovelaceConfigGenerator(filesystem, transformer);

            filesystem.WriteFileAsync(@"Z:\output\battery-entities.yaml", @"
- entity: sensor.my_existing_device_battery
  name: My existing device
");

            filesystem.WriteFileAsync(@"Z:\source\devices.yaml", @"
# My test device
- deviceId: Test device
  platform: hubitat
  sensors:
  - type: battery
".Trim());

            var expectedConfig = @"
- entity: sensor.my_existing_device_battery
  name: My existing device
- entity: sensor.test_device_battery
  name: Test device
".Trim();

            // Action
            Task.WaitAll(generator.GenerateConfigAsync(@"Z:\source", @"Z:\output"));
            var generatedConfig = filesystem.ReadFileAsync(@"Z:\output\battery-entities.yaml").Result;

            // Assert
            Assert.AreEqual(expectedConfig, generatedConfig.Trim(), "Config declared as expected");
        }
        public void Button_entities_file_is_generated()
        {
            // Arrange
            var filesystem  = new DummyFilesystem();
            var transformer = new LovelaceConfigTransformer(new DeviceTranslator());
            var generator   = new LovelaceConfigGenerator(filesystem, transformer);

            filesystem.WriteFileAsync(@"Z:\source\devices.yaml", @"
# My test button
- deviceId: Test button
  platform: hubitat
  sensors:
  - type: button
  - type: hold-button
".Trim());

            var expectedConfig = @"
- type: custom:fold-entity-brick
  entity: binary_sensor.test_button_active
  entities:
  - entity: binary_sensor.test_button
    name: Push
  - entity: binary_sensor.test_button_hold
    name: Hold
".Trim();

            // Action
            Task.WaitAll(generator.GenerateConfigAsync(@"Z:\source", @"Z:\output"));
            var generatedConfig = filesystem.ReadFileAsync(@"Z:\output\button-entities.yaml").Result;

            // Assert
            Assert.AreEqual(expectedConfig, generatedConfig.Trim(), "Config declared as expected");
        }
        public void Offline_entities_file_is_generated()
        {
            // Arrange
            var filesystem  = new DummyFilesystem();
            var transformer = new LovelaceConfigTransformer(new DeviceTranslator());
            var generator   = new LovelaceConfigGenerator(filesystem, transformer);

            filesystem.WriteFileAsync(@"Z:\source\devices.yaml", @"
# My test device
- deviceId: Test device
  platform: hubitat
  sensors:
  - type: offline
".Trim());

            var expectedConfig = @"
- entity: binary_sensor.test_device_offline
  name: Test device
".Trim();

            // Action
            Task.WaitAll(generator.GenerateConfigAsync(@"Z:\source", @"Z:\output"));
            var generatedConfig = filesystem.ReadFileAsync(@"Z:\output\offline-entities.yaml").Result;

            // Assert
            Assert.AreEqual(expectedConfig, generatedConfig.Trim(), "Config declared as expected");
        }