Ejemplo n.º 1
0
        public async Task TestUpdateGatewayAsync()
        {
            var c        = new Lassie.Client();
            var template = new Lassie.Gateway
            {
                GatewayEUI = NewRandomEUI().ToString(),
                IP         = "127.0.0.1",
                StrictIP   = false,
            };
            var gw = await c.CreateGatewayAsync(template);

            gw.Tags["name"] = "bar";
            gw.Tags["foo"]  = "bar";

            gw.Latitude  = 1.0f;
            gw.Longitude = 2.0f;
            gw.Altitude  = 3.0f;

            var updated = await c.UpdateGatewayAsync(gw);

            Assert.NotNull(updated);
            Assert.Equal(updated.Tags["name"], "bar");
            Assert.Equal(updated.Tags["foo"], "bar");

            Assert.Equal(updated.Latitude, 1.0f);
            Assert.Equal(updated.Longitude, 2.0f);
            Assert.Equal(updated.Altitude, 3.0f);
            await c.DeleteGateway(gw.GatewayEUI);
        }
Ejemplo n.º 2
0
        public async Task TestCreateAndDeleteGatewayAsync()
        {
            var c        = new Lassie.Client();
            var template = new Lassie.Gateway
            {
                GatewayEUI = NewRandomEUI().ToString(),
                IP         = "127.0.0.1",
                StrictIP   = false,
            };
            var gw = await c.CreateGatewayAsync(template);

            Assert.NotNull((gw));
            Assert.Equal(gw.GatewayEUI.ToLower(), template.GatewayEUI.ToLower());
            Assert.Equal(gw.IP, template.IP);

            await c.DeleteGateway(gw.GatewayEUI);
        }