Ejemplo n.º 1
0
        public async Task ReturnGame(string name, string lastName, string nameGame, Platform platform, Genre genre)
        {
            Thread.Sleep(4000);
            #region Game
            Expression <Func <Game, bool> > expressionGame = x => x.Name == nameGame && x.Platform == platform && x.Genre == genre;

            Game game = await _serviceGame.GetFirst(expressionGame);

            #endregion

            #region Friend
            Expression <Func <Friend, bool> > expressionFriend = x => x.Name == name && x.LastName == lastName;

            Friend friend = await _serviceFriend.GetFirst(expressionFriend);

            #endregion

            var result = await _serviceBorrowedGame.ReturnGame(new BorrowDto
            {
                IdFriend = friend.Id,
                IdGame   = game.Id
            });

            Assert.True(result.Success);
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> ReturnGame(BorrowDto borrowDto)
        {
            try
            {
                var response = await _serviceBorrowedGame.ReturnGame(borrowDto);

                return(Ok(response));
            }
            catch (Exception)
            {
                return(BadRequest(new GameResponse(NotificacaoDto.ErroPadrao)));
            }
        }