コード例 #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);
        }
コード例 #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();
        }
コード例 #3
0
ファイル: DevicesDal.cs プロジェクト: Tranzystor/nhibernate
 public void AddDevice(Device device)
 {
     SaveOrUpdate(device);
 }