public void CheckPerspectiveMembershipAfterSerialization_Positive()
        {
            {
                var    handler = new TabularModelHandler();
                var    model   = handler.Model;
                Table  t1      = model.AddCalculatedTable("Table1");
                Column c1      = t1.AddCalculatedColumn("Column1");
                Column c2      = t1.AddCalculatedColumn("Column2");
                var    p1      = model.AddPerspective("TestPerspective");

                c1.InPerspective[p1] = true;
                Assert.AreEqual(true, t1.InPerspective[p1]);
                Assert.AreEqual(true, c1.InPerspective[p1]);
                Assert.AreEqual(false, c2.InPerspective[p1]);

                Directory.CreateDirectory("test_2_7_4_perspective_membership_1");
                handler.Save("test_2_7_4_perspective_membership_1", SaveFormat.TabularEditorFolder, new SerializeOptions {
                    LocalPerspectives = true
                });
            }

            {
                // Load from folder:
                var handler = new TabularModelHandler("test_2_7_4_perspective_membership_1");
                var model   = handler.Model;
                var p1      = model.Perspectives["TestPerspective"];
                var t1      = model.Tables["Table1"];
                var c1      = t1.Columns["Column1"];
                var c2      = t1.Columns["Column2"];

                Assert.AreEqual(true, t1.InPerspective[p1]);
                Assert.AreEqual(true, c1.InPerspective[p1]);
                Assert.AreEqual(false, c2.InPerspective[p1]);
            }
        }
Esempio n. 2
0
        private CalculatedColumn CreateDummyColumn(Table table, DataType dataType = DataType.String)
        {
            var result = table.AddCalculatedColumn(Guid.NewGuid().ToString());

            result.IsHidden = true;
            result.DataType = dataType;
            DummyColumns.Add(result.Name);
            return(result);
        }