public void DetailInFunctionTest()
        {
            var dvd = new DetailVariableDef();

            dvd.ConnectMasterPorp = "Берлога";
            dvd.OwnerConnectProp  = new[] { SQLWhereLanguageDef.StormMainObjectKey };
            dvd.View = Information.GetView("МедведьE", typeof(Медведь));
            dvd.Type = langdef.GetObjectType("Details");

            var function = langdef.GetFunction(langdef.funcExist, dvd, langdef.GetFunction(langdef.funcEQ, new VariableDef(langdef.GuidType, "Наименование"), string.Empty));

            var expectedPropertiesUsedInFunction = new List <string> {
                "Наименование"
            };

            var propertiesUsedInFunction = new List <string>();
            var detailList = new List <ViewPropertyAppender.DetailVariableDefContainer>();

            ViewPropertyAppender.FindPropertiesUsedInFunction(function, propertiesUsedInFunction, detailList);
            Assert.Equal(0, propertiesUsedInFunction.Count);
            Assert.Equal(1, detailList.Count);

            var intersection = expectedPropertiesUsedInFunction.Intersect(detailList[0].DetailVariablesList).ToList();

            Assert.Equal(expectedPropertiesUsedInFunction.Count, intersection.Count);
        }
        public void NullFunctionTest()
        {
            var expectedPropertiesUsedInFunction = new List <string>();
            var propertiesUsedInFunction         = new List <string>();

            ViewPropertyAppender.FindPropertiesUsedInFunction(null, expectedPropertiesUsedInFunction, new List <ViewPropertyAppender.DetailVariableDefContainer>());
            var intersection = expectedPropertiesUsedInFunction.Intersect(propertiesUsedInFunction).ToList();

            Assert.Equal(expectedPropertiesUsedInFunction.Count, intersection.Count);
        }
        public void SimpleDoubledPropertyTest()
        {
            var function = langdef.GetFunction(
                langdef.funcAND,
                langdef.GetFunction(langdef.funcEQ, langdef.GetFunction(langdef.funcYearPart, new VariableDef(langdef.DateTimeType, "ДатаВыдачи")), "2012"),
                langdef.GetFunction(langdef.funcEQ, langdef.GetFunction(langdef.funcMonthPart, new VariableDef(langdef.DateTimeType, "ДатаВыдачи")), "12"));

            var expectedPropertiesUsedInFunction = new List <string> {
                "ДатаВыдачи"
            };

            var propertiesUsedInFunction = new List <string>();

            ViewPropertyAppender.FindPropertiesUsedInFunction(function, propertiesUsedInFunction, new List <ViewPropertyAppender.DetailVariableDefContainer>());

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

            Assert.Equal(expectedPropertiesUsedInFunction.Count, intersection.Count);
        }