Ejemplo 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);
        }
Ejemplo 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();
        }
Ejemplo n.º 3
0
 public void AddDevice(Device device)
 {
     SaveOrUpdate(device);
 }