Ejemplo n.º 1
0
        public void UpdateCurrentAction()
        {
            var newCurrentAction = CurrentStateGenerator.Generate(BinarySwitch.Power, PowerSensor.Value);

            if (newCurrentAction != CurrentAction)
            {
                CurrentAction = newCurrentAction;

                var @event = DeviceEvent.CurrentActionChanged(this, null);
                AddEvent(@event);
            }
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
        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));
        }