Exemplo n.º 1
0
        public async Task TestUpdateDevice()
        {
            var c   = new Lassie.Client();
            var app = await c.CreateApplicationAsync(new Lassie.Application());

            var device = await c.CreateDeviceAsync(app.ApplicationEUI, new Lassie.Device {
                DeviceType = Lassie.Device.ABP
            });

            Assert.NotNull(device);
            Assert.Equal(Lassie.Device.ABP, device.DeviceType);

            device.Tags["name"]   = "foo";
            device.RelaxedCounter = true;
            device.ApplicationKey = "01020304aabbccdd01020304aabbccdd";
            var updated = await c.UpdateDeviceAsync(app.ApplicationEUI, device);

            Assert.Equal(device.RelaxedCounter, updated.RelaxedCounter);
            Assert.Equal(device.ApplicationKey, updated.ApplicationKey);
            Assert.Equal("foo", device.Tags["name"]);

            var dd = await c.GetDeviceDataAsync(app.ApplicationEUI, device.DeviceEUI);

            Assert.Equal(0, dd.Messages.Length);
            await c.DeleteDeviceAsync(app.ApplicationEUI, device.DeviceEUI);
        }
Exemplo n.º 2
0
        public async Task TestAddRemoveDevice()
        {
            var c   = new Lassie.Client();
            var app = await c.CreateApplicationAsync(new Lassie.Application());

            var device = await c.CreateDeviceAsync(app.ApplicationEUI, new Lassie.Device {
                DeviceType = Lassie.Device.OTAA
            });

            Assert.NotNull(device);

            await c.DeleteDeviceAsync(app.ApplicationEUI, device.DeviceEUI);
        }