/// <summary>
 /// Deletes devices
 /// </summary>
 /// <param name="device">Devise to delete</param>
 /// <param name="error">Error message</param>
 public void DeleteDevice(Device device, out string error)
 {
     error = string.Empty;
     try
     {
         _dalContext.DevicesRepository.Delete(device);
     }
     catch (Exception ex)
     {
         Logger.Log.ErrorFormat("Error during deleting device with Name : {0}, error: {1}", device.Name, ex);
         error = ex.Message;
     }
 }
        public void GetDeviceByIdSuccess()
        {
            int key = 5;
            Device device = new Device();
            _dalContextMock.Expect(x => x.DevicesRepository).Repeat.Once().Return(_devicesRepository);
            _devicesRepository.Expect(x => x.GetById(key)).Repeat.Once().Return(device);

            PerformTest(devicesService =>
                {
                    string error;
                    Device actualDevice = devicesService.GetDeviceById(key, out error);

                    Assert.IsNull(error);
                    Assert.AreEqual(device, actualDevice);
                });
        }
 public DevicesViewModel(Device currentDevice, IEnumerable<DeviceType> types)
 {
     CurrentDevice = currentDevice;
     DeviceTypes = new SelectList(types, "Key", "Name", currentDevice.TypeId);
 }