Beispiel #1
0
        public void ShouldRemoveEmptyFormatItems()
        {
            var formatBlock = new DslFormatBlock
            {
                Selects = new List <DslFormatItem>
                {
                    new DslFormatItem
                    {
                        Value = "Test"
                    },
                    new DslFormatItem
                    {
                        Value = string.Empty
                    },
                    new DslFormatItem
                    {
                        Value = null
                    }
                }
            };

            var sourceModel = new DslDataQuery
            {
                Blocks = new IDslQueryBlock[]
                {
                    formatBlock
                }
            };

            _target.Validate(sourceModel);

            formatBlock.Selects.Count().ShouldBeEquivalentTo(1);
        }
        private void ProcessSelects(DataSourceInfo dataSource, long userId, DslFormatBlock firstFormatBlock)
        {
            foreach (var selectItem in firstFormatBlock.Selects)
            {
                var selectItemProperty = _queryVariableNameBuilder.Decode(selectItem.Value);

                ProcessSelectItem(dataSource, userId, selectItem, selectItemProperty);
            }
        }