public void ShouldReturnTrueWhenHaveAccessToLocalField()
        {
            const string expression        = "Name.ToString()";
            const string currentDataSource = "datasource";
            const int    userId            = 234;

            _dataSourceAccessValidator.Setup(_ => _.CanReadSource(currentDataSource, userId)).Returns(true);

            _queryVariableNameBuilder.Setup(_ => _.IsSimpleValue("Name")).Returns(true);
            _queryVariableNameBuilder.Setup(_ => _.IsSimpleValue("ToString()")).Returns(false);

            var fieldInfo = new DataSourceFieldInfo();

            _dataSourceFieldInfoProvider
            .Setup(_ => _.TryGet(currentDataSource, "Name", userId))
            .Returns(fieldInfo);

            DataSourceFieldInfo resultFieldInfo;

            var result = _target.IsAccessible(expression, currentDataSource, userId, out resultFieldInfo);

            result.Should().BeTrue();
        }
        private void ProcessSelectItem(DataSourceInfo dataSource,
                                       long userId,
                                       DslFormatItem selectItem,
                                       string selectItemProperty)
        {
            if (string.IsNullOrEmpty(selectItem.Name))
            {
                selectItem.Name = selectItemProperty;
            }

            var isValueField = _queryVariableNameBuilder.IsSimpleValue(selectItemProperty);

            if (!isValueField)
            {
                if (string.IsNullOrEmpty(selectItem.Name))
                {
                    throw new SelectFieldNameEmptyException(selectItem.Value);
                }
            }

            DataSourceFieldInfo inheritedField;

            var isCanRequestColumn = _formatBlockValueAccessEvaluator.IsAccessible(
                selectItemProperty,
                dataSource.Key,
                userId,
                out inheritedField);

            if (!isCanRequestColumn)
            {
                selectItem.Value = QueryKey.QueryEmptyString;

                return;
            }

            if (inheritedField == null)
            {
                return;
            }

            SetSelectItemInfoFromField(selectItem, inheritedField);
        }