public override ARESULT Initialize(Dictionary <string, object> arguments) { service = arguments["service"] as CellService; device = arguments["device"] as IDevice; // 读取配置信息 if (!device.Read(ReadMode.IrCameraParameters, null, out object outData, out _)) { return(ARESULT.E_INVALIDARG); } irCameraParameters = outData as Repository.Entities.Configuration.IrCameraParameters; tempertureDuration = 1000 / irCameraParameters.temperatureFrameRate; // 声明事件处理函数 onReceiveTemperature = (arguments) => { if (arguments[0] == device) { temperature = Arrays.Clone(arguments[1] as float[], temperature); } }; onReceiveImage = (arguments) => { if (arguments[0] == device) { image = Arrays.Clone(arguments[1] as byte[], image); } }; return(base.Initialize(arguments)); }
public void DecreaseCell_WithoutAvaliableCells_ShouldReturnAnException() { var vehicleType = VehicleTypeEnum.car; var listCells = new List <CellEntity> { new CellEntity { Id = Guid.NewGuid().ToString(), IdVehicleType = vehicleType, NumCellAvaliable = 0, NumTotalCells = 4 } }; var cellExceptionMessage = "No hay más celdas disponibles"; _cellRepository.Setup(cs => cs.List(cell => cell.IdVehicleType == vehicleType)).Returns(listCells); var cellService = new CellService(_cellRepository.Object); try { cellService.DecreaseCell(vehicleType, 1); } catch (Exception e) { Assert.AreEqual(e.Message, cellExceptionMessage); throw; } }
public override ARESULT Initialize(Dictionary <string, object> arguments) { cell = arguments["cell"] as CellService; device = arguments["device"] as IDevice; // 读取配置信息 if (device.Read(ReadMode.IrCameraParameters, null, out object outData, out _)) { // 创建资源 var irCameraParameters = outData as Repository.Entities.Configuration.IrCameraParameters; temperature = PinnedBuffer <float> .Alloc(irCameraParameters.temperatureWidth *irCameraParameters.temperatureHeight, irCameraParameters.temperatureWidth, irCameraParameters.temperatureHeight); irImage = PinnedBuffer <byte> .Alloc(irCameraParameters.width *irCameraParameters.height * 3 / 2, irCameraParameters.width, irCameraParameters.height); tempertureDuration = 1000 / irCameraParameters.temperatureFrameRate; } // 读取配置信息 if (device.Read(ReadMode.CameraParameters, null, out outData, out _)) { // 创建资源 var cameraParameters = outData as Repository.Entities.Configuration.CameraParameters; image = PinnedBuffer <byte> .Alloc(cameraParameters.width *cameraParameters.height * 3 / 2, cameraParameters.width, cameraParameters.height); videoDuration = 1000 / cameraParameters.videoFrameRate; } return(base.Initialize(arguments)); }
public TurnAction(PlayerService playerService, CellService cellService, ItemService itemService) { PlayerService = playerService; CellService = cellService; ItemService = itemService; Fight = Globals.Services.GetService <Fight>(); }
/// <summary> /// 构造函数 /// </summary> /// <param name="cell">设备单元服务</param> public SetParameterForm(CellService cell) { InitializeComponent(); this.cell = cell; GetParameters(); InitializeDrawArea(); }
public PartnerExcelFileHandler(StagedPartnerService stagedPartnerService, PartnerService partnerService, ChurchService churchService, CellService cellService, PCFService pcfService) { _stagedPartnerService = stagedPartnerService; _partnerService = partnerService; _churchService = churchService; _cellService = cellService; _pcfService = pcfService; }
public void TestFixtureSetup() { BaiduMapperService.MapCellView(); InfrastructureMapperService.MapCell(); _eNodebRepository.MockThreeENodebs(); _repository.MockRangeCells(); _service = new CellService(_repository.Object, _eNodebRepository.Object); }
public void IsDeletingSelectedCell() { var options = new DbContextOptionsBuilder <AppDbContext>() .UseInMemoryDatabase(databaseName: "Add_writes_to_Delete_Cell_database") .Options; var appDbContext = new AppDbContext(options); var user = new ClaimsPrincipal(new ClaimsIdentity(new Claim[] { new Claim(ClaimTypes.Name, "abcd"), })); appDbContext.UserPermissions.Add(new UserPermission { Id = 1, UserName = "******", IdPrison = 1, Prison = new Prison { Id = 1, PrisonName = "prison_test" } }); appDbContext.SaveChanges(); var loggerRepository = new LoggerRepository(appDbContext); var loggerService = new LoggerService(loggerRepository); var cellRepository = new CellRepository(appDbContext); var cellService = new CellService(cellRepository); var cellController = new PCellsController( cellService, _mapper, loggerService) { ControllerContext = new ControllerContext { HttpContext = new DefaultHttpContext { User = user } } }; appDbContext.Cells.Add(new Cell { Id = 1, Beds = 2, IdPrison = 1, IdCellType = 1, Prison = new Prison(), CellType = new CellType(), Prisoner = new List <Prisoner>() }); appDbContext.SaveChanges(); Assert.AreEqual(appDbContext.Cells.Count(), 1); cellController.DeleteCell(1); Assert.AreEqual(appDbContext.Cells.Count(), 0); }
public override void Initialize(Dictionary <string, object> arguments) { cell = CellServiceManager.gIRServiceList[(int)arguments["CellId"]]; cell.OnImageCallback += OnImageCallback; cell.OnTempertureCallback += OnTemperatureCallback; CreateImageBuffer(cell.mCell.mIRCameraWidth * cell.mCell.mIRCameraHeight); encoder.Initialize(cell.mCell.mIRCameraWidth, cell.mCell.mIRCameraHeight, cell.mCell.mIRCameraVideoFrameRate); }
public void TestFixtureSetup() { var module = new AbpAutoMapperModule(_typeFinder); module.PostInitialize(); _eNodebRepository.MockThreeENodebs(); _repository.MockRangeCells(); _service = new CellService(_repository.Object, _eNodebRepository.Object, _rruRepository.Object, null); }
/// <summary> /// 构造函数 /// </summary> /// <param name="cell">设备单元服务</param> /// <param name="device">设备</param> public CameraDeviceForm(CellService cell, IDevice device) { InitializeComponent(); // 初始化窗体 if (device.Read(ReadMode.CameraParameters, null, out object outData, out _)) { var cameraParameters = outData as Repository.Entities.Configuration.CameraParameters; RenderableControl.InitializeComponent(this, cameraParameters.width, cameraParameters.stride, cameraParameters.height); }
public PartnerController(IUnitOfWork unitOfWork, ChurchService churchService, StagedPartnerService stagedPartnerService, PartnerService partnerService, PartnerExcelFileHandler fileHandler, CellService cellService, PCFService pcfService) : base(unitOfWork) { _churchService = churchService; _stagedPartnerService = stagedPartnerService; _partnerService = partnerService; _fileHandler = fileHandler; _cellService = cellService; _pcfService = pcfService; }
public void Initialize(CellService cell) { this.cell = cell; cell.OnImageCallback += OnImageCallback; cell.OnTempertureCallback += OnTemperatureCallback; refbase = new RefBase(() => { base.Discard(); base.Join(); }); CreateImageBuffer(cell.mCell.mIRCameraWidth * cell.mCell.mIRCameraHeight); encoder.Initialize(cell.mCell.mIRCameraWidth, cell.mCell.mIRCameraHeight, cell.mCell.mIRCameraVideoFrameRate); }
public AjaxListController(ZoneService zoneService, GroupService groupService, ChurchService churchService, PartnershipArmService armService, CurrencyService currencyService, PCFService pcfService, CellService cellService) { _zoneService = zoneService; _groupService = groupService; _churchService = churchService; _armService = armService; _currencyService = currencyService; _pcfService = pcfService; _cellService = cellService; }
public void AddCellUnitTests() { // Arrange var options = new DbContextOptionsBuilder <AppDbContext>() .UseInMemoryDatabase(databaseName: "database_to_add_cellUT") .Options; var appDbContext = new AppDbContext(options); var mappingConfig = new MapperConfiguration(mc => { mc.AddProfile(new ModelToResourceProfile()); }); IMapper mapper = mappingConfig.CreateMapper(); var user = new ClaimsPrincipal(new ClaimsIdentity(new Claim[] { new Claim(ClaimTypes.Name, "abcd"), })); appDbContext.UserPermissions.Add(new UserPermission { Id = 1, UserName = "******", IdPrison = 1, Prison = new Prison { Id = 1, PrisonName = "prison_test" } }); appDbContext.SaveChanges(); var loggerRepository = new LoggerRepository(appDbContext); var loggerService = new LoggerService(loggerRepository); var cellRepository = new CellRepository(appDbContext); var cellService = new CellService(cellRepository); var pCellsController = new PCellsController( cellService, mapper, loggerService) { ControllerContext = new ControllerContext { HttpContext = new DefaultHttpContext { User = user } } }; // Act var result = pCellsController.AddCell(new CellDTO()); // Assert Assert.IsInstanceOf <ActionResult <CellVM> >(result); }
/// <summary> /// 构造函数 /// </summary> /// <param name="cell">设备单元服务</param> public RealtimeForm(CellService cell) { InitializeComponent(); this.cell = cell; SetPaletteMode(PaletteMode.Ironbow1); SetDisplayMode(DisplayMode.TwoViews); panelAlarmList.Controls.Add(new AlarmInformationList { Dock = DockStyle.Fill }); }
/// <summary> /// 构造函数 /// </summary> /// <param name="cell">设备单元服务</param> public DataVisualizationForm1(CellService cell) { InitializeComponent(); this.cell = cell; ShowControl(panel_camera, new CameraDeviceForm(cell, cell.devices[0])); ShowControl(panel_ircamera, new IrCameraDeviceForm(cell, cell.devices[0])); panel_alarms.Controls.Add(new AlarmInformationList1 { Dock = DockStyle.Fill, labelAlarmCount = label_alarm_count }); }
public void IsCellAdded() { var options = new DbContextOptionsBuilder <AppDbContext>() .UseInMemoryDatabase(databaseName: "database_to_add_cell") .Options; var appDbContext = new AppDbContext(options); var user = new ClaimsPrincipal(new ClaimsIdentity(new Claim[] { new Claim(ClaimTypes.Name, "abcd"), })); appDbContext.UserPermissions.Add(new UserPermission { Id = 1, UserName = "******", IdPrison = 1, Prison = new Prison { Id = 1, PrisonName = "prison_test" } }); appDbContext.SaveChanges(); var loggerRepository = new LoggerRepository(appDbContext); var loggerService = new LoggerService(loggerRepository); var cellRepository = new CellRepository(appDbContext); var cellService = new CellService(cellRepository); var cellController = new PCellsController( cellService, _mapper, loggerService) { ControllerContext = new ControllerContext { HttpContext = new DefaultHttpContext { User = user } } }; var cell1 = new CellDTO { Beds = 1, IdCellType = 1, }; Assert.IsFalse(appDbContext.Cells.Any(), "Cell was added before it should be"); cellController.AddCell(cell1); Assert.AreEqual(1, appDbContext.Cells.Count(), "amount of cells is wrong"); }
// GET: Zone public SetupController(IUnitOfWork unitOfWork, ChurchService churchService, GroupService groupService, ZoneService zoneService, PartnershipArmService armService, PCFService pcfService, CellService cellService, CurrencyService currencyService, ApplicationUserManager userManager) : base(unitOfWork) { _churchService = churchService; _groupService = groupService; _zoneService = zoneService; _armService = armService; _pcfService = pcfService; _cellService = cellService; _currencyService = currencyService; _userManager = userManager; }
public override ARESULT Initialize(Dictionary <string, object> arguments) { // TODO: delete 读取配置信息 configuration = Repository.Repository.LoadConfiguation(); cell = arguments["cell"] as CellService; device = arguments["device"] as IDevice; device.Handler += OnDeviceEvent; // 读取配置信息 if (!device.Read(ReadMode.IrCameraParameters, null, out object outData, out _)) { return(ARESULT.E_INVALIDARG); } irCameraParameters = outData as Configuration.IrCameraParameters; // 声明事件处理函数 onReceiveTemperature = (args) => { if ((args[0] == cell) && (args[1] == device)) { temperature = Arrays.Clone(args[2] as PinnedBuffer <float>, temperature, sizeof(float)); } }; onReceiveIrImage = (args) => { if ((args[0] == cell) && (args[1] == device)) { irImage = Arrays.Clone(args[2] as PinnedBuffer <byte>, irImage, sizeof(byte)); } }; onReceiveImage = (args) => { if ((args[0] == cell) && (args[1] == device)) { image = Arrays.Clone(args[2] as PinnedBuffer <byte>, image, sizeof(byte)); } }; onAlarm = (args) => { if ((args[0] == cell) && (args[1] == device)) { OnAlarm(args); } }; return(base.Initialize(arguments)); }
public void Setup() { var optionsBuilder = new DbContextOptionsBuilder <ParkingDbContext>().UseInMemoryDatabase("integrationTestDB"); contexto = new ParkingDbContext(optionsBuilder.Options); entryRepository = new Repository <EntryEntity>(contexto); cellRepository = new Repository <CellEntity>(contexto); departureRepository = new Repository <DepartureEntity>(contexto); rateRepository = new Repository <RateEntity>(contexto); placaRepository = new Repository <PlacaEntity>(contexto); picoPlacarepository = new Repository <PicoPlacaDigits>(contexto); cellService = new CellService(cellRepository); rateService = new RateService(rateRepository); placaService = new PlacaService(placaRepository, picoPlacarepository); departureService = new DepartureService(departureRepository, entryRepository, rateService, cellService); contexto.Database.EnsureCreated(); }
public override ARESULT Initialize(Dictionary <string, object> arguments) { cell = arguments["cell"] as CellService; device = arguments["device"] as IDevice; uri = arguments["uri"] as string; width = (int)arguments["width"]; height = (int)arguments["height"]; frameRate = (int)arguments["frameRate"]; eventName = arguments["eventName"] as string; duration = 1000 / frameRate; onReceiveImage = (args) => { if ((args[0] == cell) && (args[1] == device)) { image = Arrays.Clone(args[2] as PinnedBuffer <byte>, image, sizeof(byte)); } }; return(base.Initialize(arguments)); }
public void IncreaseCell_Should_Return_NumCellAvaliable_To4() { var vehicleType = VehicleTypeEnum.car; var listCells = new List <CellEntity> { new CellEntity { Id = Guid.NewGuid().ToString(), IdVehicleType = vehicleType, NumCellAvaliable = 3, NumTotalCells = 4 } }; _cellRepository.Setup(cs => cs.List(cell => cell.IdVehicleType == vehicleType)).Returns(listCells); var cellService = new CellService(_cellRepository.Object); var response = cellService.IncreaseCell(vehicleType, 1); Assert.IsTrue(response.NumCellAvaliable == 4); }
public void IsSelectingRight() { var options = new DbContextOptionsBuilder <AppDbContext>() .UseInMemoryDatabase(databaseName: "Add_writes_to_select_cell_database") .Options; var appDbContext = new AppDbContext(options); var loggerRepository = new LoggerRepository(appDbContext); var loggerService = new LoggerService(loggerRepository); var cellRepository = new CellRepository(appDbContext); var cellService = new CellService(cellRepository); var cellController = new PCellsController( cellService, _mapper, loggerService); appDbContext.Cells.Add(new Cell { Id = 1, Beds = 2, IdPrison = 1, IdCellType = 1, Prison = new Prison(), CellType = new CellType(), Prisoner = new List <Prisoner>() }); appDbContext.SaveChanges(); var createdCell = appDbContext.Cells.FirstOrDefault(x => x.Id == 1); Assert.IsTrue(appDbContext.Cells.Any(), "there is no cell"); Assert.IsNotNull(createdCell, "cell was not created properly"); Assert.IsNotNull(cellController.SelectedCell(1), "selected cell returns null"); // Assert.IsNotNull(cellController.SelectedCell(1).Value,"Selected cell ok results value is null"); //rip c#7, gonna be fixed in c#8 // Assert.AreEqual(_mapper.Map<CellVM>(createdCell),cellController.SelectedCell(1).Value,"Selected Cell returns wrong value");// rip c#7, gonna be fixed in c#8 }
public CellStationController(CellService service) { _service = service; }
public NbIotCellSiteController(CellService service, ENodebQueryService eNodebQueryService) { _service = service; _eNodebQueryService = eNodebQueryService; }
public CellController(CellService service) { _service = service; }
public CellInUseController(CellService service, CellRruService rruService) { _service = service; _rruService = rruService; }
public CellLookupController(CellService cellService) { _cellService = cellService; }
public void IsUpdatingSelectedCell() { var options = new DbContextOptionsBuilder <AppDbContext>() .UseInMemoryDatabase(databaseName: "Add_writes_to_Update_Cell_database") .Options; var appDbContext = new AppDbContext(options); var user = new ClaimsPrincipal(new ClaimsIdentity(new Claim[] { new Claim(ClaimTypes.Name, "abcd"), })); appDbContext.UserPermissions.Add(new UserPermission { Id = 1, UserName = "******", IdPrison = 1, Prison = new Prison { Id = 1, PrisonName = "prison_test" } }); appDbContext.SaveChanges(); var loggerRepository = new LoggerRepository(appDbContext); var loggerService = new LoggerService(loggerRepository); var cellRepository = new CellRepository(appDbContext); var cellService = new CellService(cellRepository); var cellController = new PCellsController( cellService, _mapper, loggerService) { ControllerContext = new ControllerContext { HttpContext = new DefaultHttpContext { User = user } } }; appDbContext.CellTypes.Add(new CellType { Id = 1, CellName = "abcd" }); cellController.AddCell(new CellDTO { Beds = 1, IdCellType = 1, }); var cellToUpdate = new CellDTO { Beds = 5, IdCellType = 1 }; Assert.AreEqual(appDbContext.Cells.Count(), 1); cellController.UpdateCell(1, cellToUpdate); Assert.AreEqual(appDbContext.Cells.Count(), 1, "Cell has not deleted or added, instead of updating"); Assert.AreEqual(appDbContext.Cells.FirstOrDefault(x => x.Id == 1).Beds, 5, "The cell updated wrong value"); }
public SectorViewController(CellService service) { _service = service; }
public LteRruCellController(CellService service) { _service = service; }
public GDIIrCameraDeviceForm(CellService cell, IDevice device) : base(cell, device) { }