public async Task ComponentReadDesiredProperties()
        {
            TwinProperties desiredProps = new TwinProperties();

            desiredProps.Desired = new TwinCollection(@"{c1: { __t: 'c', prop1: { value: 'val1'}}}");
            Twin desired = new Twin(desiredProps);

            mockClient.DesiredProperties = desired;
            var result = await pnpClient.ReadDesiredComponentPropertyAsync <string>("c1", "prop1");

            Assert.Equal("val1", result);
        }
Beispiel #2
0
        private async Task InitDeviceAsync()
        {
            await pnpClient.ReportPropertyAsync("serialNumber", serialNumber);

            await pnpClient.ReportComponentPropertyCollectionAsync("deviceInfo", DeviceInfo.ThisDeviceInfo.ToDictionary());

            var targetTemp1 = await pnpClient.ReadDesiredComponentPropertyAsync <double>("thermostat1", "targetTemperature");

            CurrentTemperature1 = targetTemp1;
            var targetTemp2 = await pnpClient.ReadDesiredComponentPropertyAsync <double>("thermostat2", "targetTemperature");

            CurrentTemperature2 = targetTemp2;
        }