Ejemplo n.º 1
0
        public void TestWithoutDisplayFolders()
        {
            var handler = new TabularModelHandler(1470);
            var tree    = new TabularUITree(handler);
            var model   = handler.Model;

            tree.Options = LogicalTreeOptions.Default & ~LogicalTreeOptions.DisplayFolders;

            var t1 = model.AddTable("Table 1");

            t1.AddDataColumn("Column 1");
            t1.AddMeasure("Measure 1");

            var cg1 = model.AddCalculationGroup("Calc Group 1");

            cg1.Field.Name = "Field";
            var ci1 = cg1.AddCalculationItem("Item 1");

            var cg1Path = tree.GetPath(cg1);
            var ci1Path = tree.GetPath(ci1);

            Assert.AreEqual(5, ci1Path.FullPath.Length);
            Assert.IsTrue(
                ci1Path.FullPath.SequenceEqual(
                    new object[] { model, model.Groups.Tables, cg1, cg1.Field, ci1 }));

            Assert.AreEqual(1, tree.GetChildren(cg1Path).Count());

            cg1.Field.DisplayFolder = "Folder\\Subfolder";

            Assert.AreEqual(5, tree.GetPath(ci1).FullPath.Length);
        }
Ejemplo n.º 2
0
        public void TestWithDisplayFoldersShowHidden()
        {
            var handler = new TabularModelHandler(1470);
            var tree    = new TabularUITree(handler);
            var model   = handler.Model;

            tree.Options = LogicalTreeOptions.Default | LogicalTreeOptions.ShowHidden;

            var t1 = model.AddTable("Table 1");

            t1.AddMeasure("Measure 1");

            var cg1 = model.AddCalculationGroup("Calc Group 1");
            var ci1 = cg1.AddCalculationItem("Item 1");
            var cc1 = cg1.AddCalculatedColumn("Column 1");

            var cg1Path = tree.GetPath(cg1);
            var ci1Path = tree.GetPath(ci1);
            var cc1Path = tree.GetPath(cc1);

            Assert.AreEqual(5, ci1Path.FullPath.Length);
            Assert.IsTrue(
                ci1Path.FullPath.SequenceEqual(
                    new object[] { model, model.Groups.Tables, cg1, cg1.CalculationItems, ci1 }));

            Assert.AreEqual(4, tree.GetChildren(cg1Path).Count());
            Assert.IsTrue(tree.GetChildren(cg1Path).OfType <object>().SequenceEqual(new object[] {
                cg1.CalculationItems,
                cg1.Columns["Name"],
                cg1.Columns["Ordinal"],
                cc1
            }));

            Assert.IsTrue(
                cc1Path.FullPath.SequenceEqual(
                    new object[] { model, model.Groups.Tables, cg1, cc1 }));

            cc1.DisplayFolder = "Folder\\Subfolder";

            Assert.AreEqual(6, tree.GetPath(cc1).FullPath.Length);
        }