public void Test_DeviceOperator_Operate() { IDevice device = A.Fake <IDevice>(); // Using FakeItEasy 3rd party mocking framework syntax DeviceOperator deviceOperator = new DeviceOperator(device); deviceOperator.Operate(); }
public async Task <DeviceSubSearchModel> GetDeviceByLocationIdAsync(int locationId) { var location = await _context.Locations .Include(l => l.Device) .Where(l => l.LocationId == locationId).FirstOrDefaultAsync(); var device = location == null ? null : location.Device; var deviceSearch = DeviceOperator.SetDeviceSubSearchModel(device); return(deviceSearch); }
public DeviceSearchModel FindById(int deviceId) { var result = _context.Devices.Where(v => v.DeviceId == deviceId); result = (IQueryable <Device>)ExpandOperator.ExpandRelatedEntities <Device>(result); var device = result.FirstOrDefault(); var deviceSearch = DeviceOperator.SetDeviceSearchModelCascade(device); return(deviceSearch); }
protected virtual void RaisePropertyChanged(string propertyName) { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } if (propertyName == "Device") { var device = DeviceOperator.ListUpDevices().Where(x => string.Equals(x.Properties["Name"].Value, this.Device)).First(); canExcute = !(bool)device.Properties["NetEnabled"].Value; } }
public IEnumerable <DeviceSearchModel> GetAll() { var queryData = from D in _context.Devices select D; var result = QueryOperate <Device> .Execute(queryData); result = (IQueryable <Device>)ExpandOperator.ExpandRelatedEntities <Device>(result); //以下执行完后才会去数据库中查询 var devices = result.ToList(); var devicesSearch = DeviceOperator.SetDeviceSearchModelCascade(devices); return(devicesSearch); }
void Start() { instance = this; }
public WebService() { Device = new DeviceOperator(); City = new CityOperator(); }