コード例 #1
0
        public void SlicerLevelNodeCount()
        {
            var node            = this.CreateSlicerLevelNode();
            var slicerLevelNode = new SlicerLevelNode(node, ExcelSlicer.SlicerDocumentNamespaceManager);

            Assert.AreEqual("21", slicerLevelNode.Count);
            slicerLevelNode.Count = "20";
            Assert.AreEqual("20", slicerLevelNode.Count);
            Assert.AreEqual($@"<level uniqueName=""[Bill-to Customer].[by Country by City].[Country]"" sourceCaption=""Country"" count=""20"" xmlns=""{ExcelPackage.schemaMain2009}""><ranges><range startItem=""0""><i n=""[Bill-to Customer].[by Country by City].[Country].&amp;[]"" c="""" /><i n=""[Bill-to Customer].[by Country by City].[Country].&amp;[AT]"" c=""Austria"" /><i n=""[Bill-to Customer].[by Country by City].[Country].&amp;[BE]"" c=""Belgium"" /></range><range startItem=""1""><i n=""[Bill-to Customer].[by Country by City].[Country].&amp;[CA]"" c=""Canada"" /><i n=""[Bill-to Customer].[by Country by City].[Country].&amp;[DK]"" c=""Denmark"" /><i n=""[Bill-to Customer].[by Country by City].[Country].&amp;[FR]"" c=""France"" /></range></ranges></level>", node.OuterXml);
        }
コード例 #2
0
        public void SlicerLevelNodeSlicerRanges()
        {
            var node            = this.CreateSlicerLevelNode();
            var slicerLevelNode = new SlicerLevelNode(node, ExcelSlicer.SlicerDocumentNamespaceManager);

            Assert.AreEqual(2, slicerLevelNode.SlicerRanges.Count);
            Assert.AreEqual("0", slicerLevelNode.SlicerRanges[0].StartItem);
            Assert.AreEqual(3, slicerLevelNode.SlicerRanges[0].Items.Count);
            Assert.AreEqual(string.Empty, slicerLevelNode.SlicerRanges[0].Items[0].DisplayName);
            Assert.AreEqual("Austria", slicerLevelNode.SlicerRanges[0].Items[1].DisplayName);
            Assert.AreEqual("Belgium", slicerLevelNode.SlicerRanges[0].Items[2].DisplayName);
            Assert.AreEqual("1", slicerLevelNode.SlicerRanges[1].StartItem);
            Assert.AreEqual(3, slicerLevelNode.SlicerRanges[1].Items.Count);
            Assert.AreEqual("Canada", slicerLevelNode.SlicerRanges[1].Items[0].DisplayName);
            Assert.AreEqual("Denmark", slicerLevelNode.SlicerRanges[1].Items[1].DisplayName);
            Assert.AreEqual("France", slicerLevelNode.SlicerRanges[1].Items[2].DisplayName);
        }