コード例 #1
0
        public void UserDefinedCells_GetNames()
        {
            var page1 = this.GetNewPage();
            var s1    = page1.DrawRectangle(0, 0, 2, 2);

            Assert.AreEqual(0, UserDefinedCellHelper.GetCount(s1));
            UserDefinedCellHelper.Set(s1, "FOO1", "BAR1", null);
            Assert.AreEqual(1, UserDefinedCellHelper.GetCount(s1));
            UserDefinedCellHelper.Set(s1, "FOO1", "BAR2", null);
            Assert.AreEqual(1, UserDefinedCellHelper.GetCount(s1));
            UserDefinedCellHelper.Set(s1, "FOO2", "BAR3", null);

            var names1 = UserDefinedCellHelper.GetNames(s1);

            Assert.AreEqual(2, names1.Count);
            Assert.IsTrue(names1.Contains("FOO1"));
            Assert.IsTrue(names1.Contains("FOO2"));

            Assert.AreEqual(2, UserDefinedCellHelper.GetCount(s1));
            UserDefinedCellHelper.Delete(s1, "FOO1");

            var names2 = UserDefinedCellHelper.GetNames(s1);

            Assert.AreEqual(1, names2.Count);
            Assert.IsTrue(names2.Contains("FOO2"));

            UserDefinedCellHelper.Set(s1, "FOO3", "BAR1", null);
            var names3 = UserDefinedCellHelper.GetNames(s1);

            Assert.AreEqual(2, names3.Count);
            Assert.IsTrue(names3.Contains("FOO2"));
            Assert.IsTrue(names3.Contains("FOO3"));

            UserDefinedCellHelper.Delete(s1, "FOO3");

            Assert.AreEqual(1, UserDefinedCellHelper.GetCount(s1));
            UserDefinedCellHelper.Delete(s1, "FOO2");

            Assert.AreEqual(0, UserDefinedCellHelper.GetCount(s1));

            page1.Delete(0);
        }