Exemplo n.º 1
0
        public async Task Adopt_WhenDeviceOnline_ShouldAdoptAndProvisionDevice()
        {
            await MasterService.ScanNetwork();

            var device   = Network.Devices[0];
            var dbDevice = await DeviceRepository.GetDeviceAsync(device.MacAddress);

            Assert.IsNotNull(device);

            Assert.AreNotEqual(DeviceState.Adopting, dbDevice.State);
            Assert.IsNull(dbDevice.AdoptedAt);
            Assert.IsNull(dbDevice.ProvisionedAt);
            await MasterService.AdoptAsync(dbDevice._id);

            dbDevice = await DeviceRepository.GetDeviceAsync(device.MacAddress);

            Assert.AreEqual(DeviceState.Adopting, dbDevice.State);
            Assert.IsNull(dbDevice.AdoptedAt);

            device.AssertDeviceRestart();

            // Todo: Finish
        }
Exemplo n.º 2
0
 public async Task Adopt(string id)
 {
     await HandleUnresponsiveDevice(async() =>
                                    await _masterService.AdoptAsync(id)
                                    );
 }