Beispiel #1
0
        public void BuildCmFilter2()
        {
            // Setup test values
            Cache.LangProject.PeopleOA = Cache.ServiceLocator.GetInstance <ICmPossibilityListFactory>().Create();
            ICmPossibility person1 = Cache.ServiceLocator.GetInstance <ICmPersonFactory>().Create();

            Cache.LangProject.PeopleOA.PossibilitiesOS.Add(person1);
            person1.ForeColor = 5;
            person1.BackColor = 10;

            // Setup filter
            ILcmOwningCollection <ICmFilter> filtersCol = Cache.LangProject.FiltersOC;
            ICmFilter filter = Cache.ServiceLocator.GetInstance <ICmFilterFactory>().Create();

            filtersCol.Add(filter);
            filter.ColumnInfo = CmPossibilityTags.kClassId + "," + CmPossibilityTags.kflidForeColor
                                + "|" + CmPossibilityTags.kClassId + "," + CmPossibilityTags.kflidBackColor;
            ICmRow row = Cache.ServiceLocator.GetInstance <ICmRowFactory>().Create();

            filter.RowsOS.Add(row);
            ICmCell cell1 = Cache.ServiceLocator.GetInstance <ICmCellFactory>().Create();

            row.CellsOS.Add(cell1);
            cell1.Contents = MakeString("= 5");
            ICmCell cell2 = Cache.ServiceLocator.GetInstance <ICmCellFactory>().Create();

            row.CellsOS.Add(cell2);
            cell2.Contents = MakeString("= 10");

            // Check the result
            filter.InitCriteria();
            Assert.IsTrue(filter.MatchesCriteria(person1.Hvo));
        }