public async Task Should_Validate_Get_Games_User() { //Arrange //Act var serviceResult = await borrowGameService.GetBorrowGamesOfUser(userId); //Assert Assert.IsTrue(serviceResult.Success); Assert.IsNotNull(serviceResult.Result); Assert.IsEmpty(serviceResult.ValidationMessages); }
public async Task <IActionResult> GetBorrowedGamesOfUser() { try { var serviceResult = await _borrowGamesService.GetBorrowGamesOfUser(GetUserId()); if (!serviceResult.Success) { return(NotFound()); } var borrowedGames = _mapper.Map <IList <BorrowedGame>, IList <GetBorrowedGameDto> >(serviceResult.Result); return(Ok(borrowedGames)); } catch (Exception ex) { return(StatusCode(500, ex.Message)); } }