Esempio n. 1
0
        public void GetDeviceById_ShouldFindDevice()
        {
            const string serialNo = "123";

            var dev1 = new Device
            {
                SerialNo = "abc",
                DeviceMode = DeviceMode.Pairing
            };

            var dev2 = new Device
            {
                SerialNo = serialNo,
                DeviceMode = DeviceMode.Monitoring
            };

            var transaction = _session.BeginTransaction();

            _devicesDal.AddDevice(dev1);
            _devicesDal.AddDevice(dev2);

            //act
            var result = _devicesDal.GetDeviceBySerialNo(serialNo);

            //assert
            Assert.AreEqual(serialNo, result.SerialNo);
        }
Esempio n. 2
0
        public void AddNewDevice()
        {
            var dev1 = new Device
            { 
                SerialNo = "abc", 
                DeviceMode = DeviceMode.Pairing 
            };
            
            var dev2 = new Device
            {
                SerialNo = "123",
                DeviceMode = DeviceMode.Monitoring
            };

            var transaction = _session.BeginTransaction();

            //act
            _devicesDal.AddDevice(dev1);
            _devicesDal.AddDevice(dev2);

            transaction.Commit();
        }
Esempio n. 3
0
 public void AddDevice(Device device)
 {
     SaveOrUpdate(device);
 }