Пример #1
0
        public void Test_LMGroup()
        {
            var listManager = new GroupListMan(fContext);

            Assert.IsNotNull(listManager);

            var grpRec = fContext.Tree.XRefIndex_Find("G1") as GDMGroupRecord;

            listManager.Fetch(grpRec);

            listManager.QuickFilter = "*";
            Assert.IsTrue(listManager.CheckFilter());
            listManager.QuickFilter = "*roup*";
            Assert.IsTrue(listManager.CheckFilter());
            listManager.QuickFilter = "*alpha*";
            Assert.IsFalse(listManager.CheckFilter());

            var listView = Substitute.For <IListViewEx>();

            listManager.UpdateColumns(listView);
            var listItem = new GKListItem("", null);

            listManager.UpdateItem(0, listItem, grpRec);

            //
            var colVal = listManager.GetColumnInternalValue(0);

            Assert.IsNotNull(colVal);

            var data = listManager.GetItemData(grpRec);

            Assert.IsNotNull(data);
            Assert.IsTrue(data.Length > 0);

            //
            IListFilter  filter      = listManager.Filter;
            IListColumns listColumns = listManager.ListColumns;

            ListColumns copyColumns = GroupListMan.CreateGroupListColumns();

            listColumns.CopyTo(copyColumns);

            Assert.Throws(typeof(ArgumentNullException), () => { listColumns.CopyTo(null); });

            listManager.QuickFilter = "*";
            listManager.AddCondition((byte)GroupColumnType.ctName, ConditionKind.ck_Contains, "*roup*");
            Assert.IsTrue(listManager.CheckFilter());
        }
Пример #2
0
        public void Test_Lists()
        {
            ListColumn colStatic = new ListColumn(0, 0, DataType.dtString, 0, true);

            Assert.IsNotNull(colStatic);
            Assert.AreEqual(0, colStatic.Order);
            Assert.AreEqual(false, colStatic.CurActive);
            Assert.AreEqual(0, colStatic.CurWidth);

            //
            ListFilter listFilter = new ListFilter();

            Assert.IsNotNull(listFilter);
            Assert.AreEqual(0, listFilter.Conditions.Count);
            listFilter.Clear();
            Assert.AreEqual(0, listFilter.Conditions.Count);

            ListManager  listManager;
            ListViewMock lvMock = new ListViewMock();
            GKListItem   listItem;

            //
            listManager = new GroupListMan(fContext);
            Assert.IsNotNull(listManager);

            GDMGroupRecord grpRec = fContext.Tree.XRefIndex_Find("G1") as GDMGroupRecord;

            listManager.Fetch(grpRec);

            listManager.QuickFilter = "*";
            Assert.IsTrue(listManager.CheckFilter());
            listManager.QuickFilter = "*roup*";
            Assert.IsTrue(listManager.CheckFilter());
            listManager.QuickFilter = "*alpha*";
            Assert.IsFalse(listManager.CheckFilter());

            listManager.UpdateColumns(lvMock);
            listItem = new GKListItem("", null);
            listManager.UpdateItem(0, listItem, grpRec);

            //
            var colVal = listManager.GetColumnInternalValue(0);

            Assert.IsNotNull(colVal);

            var data = listManager.GetItemData(grpRec);

            Assert.IsNotNull(data);
            Assert.IsTrue(data.Length > 0);

            //
            IListFilter  filter      = listManager.Filter;
            IListColumns listColumns = listManager.ListColumns;

            ListColumns copyColumns = GroupListMan.CreateGroupListColumns();

            listColumns.CopyTo(copyColumns);

            Assert.Throws(typeof(ArgumentNullException), () => { listColumns.CopyTo(null); });

            listManager.QuickFilter = "*";
            listManager.AddCondition((byte)GroupColumnType.ctName, ConditionKind.ck_Contains, "*roup*");
            Assert.IsTrue(listManager.CheckFilter());
        }