public virtual async Task <IPage <PieceOfWork> > FindAll(IPageable pageable) { var page = await _pieceOfWorkRepository.QueryHelper() .GetPageAsync(pageable); return(page); }
public async Task UpdatePieceOfWork() { // Initialize the database await _pieceOfWorkRepository.CreateOrUpdateAsync(_pieceOfWork); await _pieceOfWorkRepository.SaveChangesAsync(); var databaseSizeBeforeUpdate = await _pieceOfWorkRepository.CountAsync(); // Update the pieceOfWork var updatedPieceOfWork = await _pieceOfWorkRepository.QueryHelper().GetOneAsync(it => it.Id == _pieceOfWork.Id); // Disconnect from session so that the updates on updatedPieceOfWork are not directly saved in db //TODO detach updatedPieceOfWork.Title = UpdatedTitle; updatedPieceOfWork.Description = UpdatedDescription; PieceOfWorkDto updatedPieceOfWorkDto = _mapper.Map <PieceOfWorkDto>(_pieceOfWork); var response = await _client.PutAsync("/api/piece-of-works", TestUtil.ToJsonContent(updatedPieceOfWorkDto)); response.StatusCode.Should().Be(HttpStatusCode.OK); // Validate the PieceOfWork in the database var pieceOfWorkList = await _pieceOfWorkRepository.GetAllAsync(); pieceOfWorkList.Count().Should().Be(databaseSizeBeforeUpdate); var testPieceOfWork = pieceOfWorkList.Last(); testPieceOfWork.Title.Should().Be(UpdatedTitle); testPieceOfWork.Description.Should().Be(UpdatedDescription); }