public async Task <GameDto> GetByIdAsync(string id, string culture) { var gameRoot = await _gameDecorator.FindSingleAsync(g => g.Id == id); if (gameRoot == null) { throw new EntityNotFoundException <GameRoot>(id); } var gameDto = await GetGameDtoAsync(gameRoot, culture, true); return(gameDto); }
public async Task GetByIdAsync_ThrowsException_WhenNotFound() { A.CallTo(() => _gameDecorator.FindSingleAsync(A <Expression <Func <GameRoot, bool> > > ._)) .Returns((GameRoot)null); Func <Task> action = async() => await _gameServices.GetByIdAsync(Id, Culture.En); await action.Should().ThrowAsync <EntityNotFoundException <GameRoot> >() .WithMessage($"Entity GameRoot wasn't found. Id: {Id}"); }
public async Task <OrderDetails> FindSingleAsync(Expression <Func <OrderDetails, bool> > predicate) { var details = await _orderDetailsRepository.FindSingleAsync(predicate); if (details == null) { return(null); } Expression <Func <GameRoot, bool> > gamePredicate = root => root.Id == details.GameRootId; var gameRoot = await _gameDecorator.FindSingleAsync(gamePredicate); details.GameRoot = gameRoot; return(details); }