コード例 #1
0
        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);
        }
コード例 #2
0
        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}");
        }
コード例 #3
0
        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);
        }