public async Task <IActionResult> GetAll([FromQuery] PoolFilter filter, [FromQuery] int rowsPerPage = 20, [FromQuery] int pageNumber = 1) { string userEmail = User.FindFirst(ClaimTypes.Email).Value; User user = await userManager.FindByEmailAsync(userEmail); PaginatedElement <Pool> pools = poolService.Get(filter, rowsPerPage, pageNumber, user); PaginatedDto <PoolDto> dto = mapper.Map <PaginatedDto <PoolDto> >(pools); dto.NextPageUrl = HttpContext.GetNextPageUrl(pageNumber < dto.PageCount); return(Ok(dto)); }
public void Get_TriggeredPoolEventHandler_OnGet() { var poolEventHandler = new FakePoolEventHandler <TestBehaviour>(); var poolService = new PoolService <TestBehaviour>(poolEventHandler, new FakePoolFactory()); poolService.Get(); Assert.That(poolEventHandler.AddTriggered, Is.True); }
private void MakeBullet() { Bullet bullet = _bulletsPool.Get(); if (bullet != null) { bullet.transform.position = transform.position; bullet.transform.rotation = transform.rotation; bullet.lifeTime = _bulletsLifeTime; } }
public void Return_TriggeredPoolEventHandler_OnReturn() { var poolEventHandler = new FakePoolEventHandler <TestBehaviour>(); var poolService = new PoolService <TestBehaviour>(poolEventHandler, new FakePoolFactory()); var obj = poolService.Get(); poolService.Return(obj); Assert.That(poolEventHandler.RemoveTriggered, Is.True); }