Exemplo n.º 1
0
        public void UpdateDeviceTest()
        {
            var manager = new InsteonDataManager(true);
            var device = new InsteonDeviceModel()
            {
                Address = "34.55.66",
                Category = 0x01,
                SubCategory = 0x02,
                DisplayName = "Test Device",
                Firmware = 0x45
            };

            var id = manager.Add(device);
            id.Should().Be(1);

            device.Id = 1;

            var d = manager.GetByAddress(device.Address);
            d.Should().NotBeNull();
            d.Address.Should().Be(device.Address);
            d.Category.Should().Be(device.Category);

            device.Category = 0x04;
            manager.Update(device);

            device.Category.Should().Be(0x04);
            d = manager.GetByAddress(device.Address);
            d.Address.Should().Be(device.Address);
            d.Category.Should().Be(device.Category);

        }
 public void Update(InsteonDeviceModel device)
 {
     using (var db = dbFactory.OpenDbConnection())
     {
         device.ModifiedDate = DateTime.UtcNow;
         db.Update(device);
     }
 }
 public void Update(InsteonDeviceModel device)
 {
     using (var db = dbFactory.OpenDbConnection())
     {
         device.ModifiedDate = DateTime.UtcNow;
         db.Update(device);
     }
 }
 public long Add(InsteonDeviceModel device)
 {
     using (var db = dbFactory.OpenDbConnection())
     {
         device.CreatedDate = DateTime.UtcNow;
         var id = db.Insert(device, selectIdentity: true);
         return id;
     }
 }
 public long Add(InsteonDeviceModel device)
 {
     using (var db = dbFactory.OpenDbConnection())
     {
         device.CreatedDate = DateTime.UtcNow;
         var id = db.Insert(device, selectIdentity: true);
         return(id);
     }
 }