public void UpdateCurrentAction() { var newCurrentAction = CurrentStateGenerator.Generate(BinarySwitch.Power, PowerSensor.Value); if (newCurrentAction != CurrentAction) { CurrentAction = newCurrentAction; var @event = DeviceEvent.CurrentActionChanged(this, null); AddEvent(@event); } }
public void Works(string steps, BinarySwitchPower?binaryPower, double wattsPower, string expected) { var generator = new CurrentStateGenerator(); if (!string.IsNullOrEmpty(steps)) { foreach (var step in steps.Split(';').Select(x => x.Split(','))) { var stepValue = double.Parse(step[0]); var stepName = step[1]; generator.AddStep(new WattsPower(stepValue), stepName); } } var actual = generator.Generate(binaryPower, new WattsPower(wattsPower)); Assert.That(actual, Is.EqualTo(expected)); }
public void Works(string steps, BinarySwitchPower? binaryPower, double wattsPower, string expected) { var generator = new CurrentStateGenerator(); if (!string.IsNullOrEmpty(steps)) { foreach (var step in steps.Split(';').Select(x => x.Split(','))) { var stepValue = double.Parse(step[0]); var stepName = step[1]; generator.AddStep(new WattsPower(stepValue), stepName); } } var actual = generator.Generate(binaryPower, new WattsPower(wattsPower)); Assert.That(actual, Is.EqualTo(expected)); }