public void AddPropertyByLimitFunctionWithExpression()
        {
            var ds       = (SQLDataService)DataServiceProvider.DataService;
            var function = langdef.GetFunction(langdef.funcEQ, new VariableDef(langdef.GuidType, "МедведьСтрокой"), "Бум");

            var view = ViewPropertyAppender.GetViewWithPropertiesUsedInFunction(Медведь.Views.МедведьShort, function, ds);

            var expectedPropertiesUsedInFunction = new List <string> {
                "МедведьСтрокой", "ПорядковыйНомер", "Мама.ЦветГлаз"
            };
            var propertiesUsedInFunction = view.Properties.Select(p => p.Name).ToList();

            var intersection = expectedPropertiesUsedInFunction.Intersect(propertiesUsedInFunction).ToList();

            Assert.Equal(expectedPropertiesUsedInFunction.Count, intersection.Count);
        }
        /// <summary>
        /// Создаётся новое представление, в которое добавляются свойства используемые в LINQ-выражении.
        /// </summary>
        /// <param name="expr">LINQ-выражение</param>
        /// <param name="dataObjectType">Тип</param>
        /// <param name="view">Начальное представление</param>
        /// <param name="dataService">Сервис данных</param>
        /// <returns>Представление</returns>
        public static View GetViewWithPropertiesUsedInExpression(Expression expr, Type dataObjectType, View view, IDataService dataService)
        {
            var lcs = LinqToLcs.GetLcs(expr, dataObjectType);

            if (lcs.ColumnsSort != null)
            {
                foreach (var sortDef in lcs.ColumnsSort)
                {
                    view.AddProperty(sortDef.Name, sortDef.Name, false, string.Empty);
                }
            }

            if (lcs.LimitFunction == null)
            {
                return(view);
            }
            return(ViewPropertyAppender.GetViewWithPropertiesUsedInFunction(view, lcs.LimitFunction, dataService));
        }