Ejemplo n.º 1
0
        public async Task CreateGame_Success()
        {
            //Arrange
            var entity = new GameBuilder().Build();

            //Act
            var response = await _gameDomainService.CreateAsync(entity);

            //Assert
            response.Should().NotBeEmpty();
        }
Ejemplo n.º 2
0
        public async Task <Response <Object> > Create(GameDto game)
        {
            var response = new Response <Object>();

            try
            {
                var gameEntity = _mapper.Map <Game>(game);
                var result     = await _gameDomainService.CreateAsync(gameEntity);

                return(response.SetResult(new { Id = result }));
            }
            catch (ValidationException ex)
            {
                return(response.SetRequestValidationError(ex));
            }
            catch (Exception ex)
            {
                Console.Write(ex.Message);
                return(response.SetInternalServerError(Resources.UnexpectedErrorWhileCreatingGame));
            }
        }