Esempio n. 1
0
        public void CopyWorks()
        {
            //TODO: include tests for when properties are null
            var device = DataHelpers.GenerateExampleDevice();
            var copy   = device.Copy();

            //TODO: assert truly separate objects
            AssertionHelpers.AssertDevicesEqual(device, copy);
        }
Esempio n. 2
0
        public void SerializationWorks(bool currentAction, bool binarySwitch, bool multilevelSwitch, bool colorSwitch, bool binarySensor, bool powerSensor, bool tempeartureSensor, bool humiditySensor, bool illuminanceSensor, bool thermostat, bool keypad)
        {
            var device = DataHelpers.GenerateExampleDevice();
            var node   = device.ToXElement();
            var copy   = node.ToDeviceState();

            AssertionHelpers.AssertDevicesEqual(device, copy,
                                                checkCurrentAction: currentAction,
                                                checkToggleSwitch: binarySwitch,
                                                checkDimmerSwitch: multilevelSwitch,
                                                checkColorSwitch: colorSwitch,
                                                checkBinarySensor: binarySensor,
                                                checkPowerSensor: powerSensor,
                                                checkTempeartureSensor: tempeartureSensor,
                                                checkHumiditySensor: humiditySensor,
                                                checkIlluminanceSensor: illuminanceSensor,
                                                checkThermostat: thermostat,
                                                checkKeypad: keypad
                                                );
        }
Esempio n. 3
0
        public void SerializationWorksWithNullProperty(bool currentAction, bool binarySwitch, bool multilevelSwitch, bool colorSwitch, bool binarySensor, bool powerSensor, bool tempeartureSensor, bool humiditySensor, bool illuminanceSensor, bool thermostat, bool keypad)
        {
            var device = DataHelpers.GenerateExampleDevice(
                type: DeviceType.Controller,
                includeCurrentAction: !currentAction,
                includeToggle: !binarySwitch,
                includeDimmer: !multilevelSwitch,
                includeColorSwitch: !colorSwitch,
                includeBinarySensor: !binarySensor,
                includePowerSensor: !powerSensor,
                includeTemperatureSensor: !tempeartureSensor,
                includeHumiditySensor: !humiditySensor,
                includeIlluminanceSensor: !illuminanceSensor,
                includeThermostat: !thermostat,
                includeKeypad: !keypad
                );
            var node = device.ToXElement();
            var copy = node.ToDeviceState();

            AssertionHelpers.AssertDevicesEqual(device, copy);
        }