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); }
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(); }
public void AddDevice(Device device) { SaveOrUpdate(device); }