public async Task CreateGame_With_GameId_Empty() { //Arrange var entity = new LoanBuilder().WithGameIdEmpty(); //Act/Assert await Assert.ThrowsAsync <ValidationException>(async () => await _loanDomainService.CreateAsync(entity)); }
public async Task <Response <object> > Create(LoanDto loan) { var response = new Response <Object>(); try { var loanEntity = _mapper.Map <Loan>(loan); var result = await _loanDomainService.CreateAsync(loanEntity); return(response.SetResult(new { Id = result })); } catch (ValidationException ex) { return(response.SetRequestValidationError(ex)); } catch (EntityNotExistsException ex) { return(response.SetNotFound(ex.Message)); } catch (GameIsOnLoanException ex) { return(response.SetBadRequest(ex.Message)); } catch (Exception ex) { Console.Write(ex.Message); return(response.SetInternalServerError(Resources.UnexpectedErrorWhileGeneratingLoan)); } }