示例#1
0
        public virtual void PushPopEveryCounterToCountersTest()
        {
            CssCounterManager manager = new CssCounterManager();

            manager.ResetCounter("counter1", 1);
            manager.ResetCounter("counter2", 2);
            NUnit.Framework.Assert.AreEqual("1", manager.ResolveCounters("counter1", ",", CounterDigitsGlyphStyle.DEFAULT
                                                                         ));
            NUnit.Framework.Assert.AreEqual("2", manager.ResolveCounters("counter2", ",", CounterDigitsGlyphStyle.DEFAULT
                                                                         ));
            IElementNode node1 = new CssPseudoElementNode(null, "name");

            manager.PushEveryCounterToCounters(node1);
            manager.ResetCounter("counter1", 3);
            manager.ResetCounter("counter2", 4);
            NUnit.Framework.Assert.AreEqual("1,3", manager.ResolveCounters("counter1", ",", CounterDigitsGlyphStyle.DEFAULT
                                                                           ));
            NUnit.Framework.Assert.AreEqual("2,4", manager.ResolveCounters("counter2", ",", CounterDigitsGlyphStyle.DEFAULT
                                                                           ));
            IElementNode node2 = new CssPseudoElementNode(null, "name");

            manager.PushEveryCounterToCounters(node2);
            manager.ResetCounter("counter1", 5);
            NUnit.Framework.Assert.AreEqual("1,3,5", manager.ResolveCounters("counter1", ",", CounterDigitsGlyphStyle.
                                                                             DEFAULT));
            NUnit.Framework.Assert.AreEqual("2,4", manager.ResolveCounters("counter2", ",", CounterDigitsGlyphStyle.DEFAULT
                                                                           ));
            IElementNode node3 = new CssPseudoElementNode(null, "name");

            manager.PushEveryCounterToCounters(node3);
            NUnit.Framework.Assert.AreEqual("1,3,5", manager.ResolveCounters("counter1", ",", CounterDigitsGlyphStyle.
                                                                             DEFAULT));
            NUnit.Framework.Assert.AreEqual("2,4", manager.ResolveCounters("counter2", ",", CounterDigitsGlyphStyle.DEFAULT
                                                                           ));
            manager.PopEveryCounterFromCounters(node3);
            NUnit.Framework.Assert.AreEqual("1,3,5", manager.ResolveCounters("counter1", ",", CounterDigitsGlyphStyle.
                                                                             DEFAULT));
            NUnit.Framework.Assert.AreEqual("2,4", manager.ResolveCounters("counter2", ",", CounterDigitsGlyphStyle.DEFAULT
                                                                           ));
            manager.PopEveryCounterFromCounters(node2);
            NUnit.Framework.Assert.AreEqual("1,3", manager.ResolveCounters("counter1", ",", CounterDigitsGlyphStyle.DEFAULT
                                                                           ));
            NUnit.Framework.Assert.AreEqual("2,4", manager.ResolveCounters("counter2", ",", CounterDigitsGlyphStyle.DEFAULT
                                                                           ));
            manager.PopEveryCounterFromCounters(node1);
            NUnit.Framework.Assert.AreEqual("1", manager.ResolveCounters("counter1", ",", CounterDigitsGlyphStyle.DEFAULT
                                                                         ));
            NUnit.Framework.Assert.AreEqual("2", manager.ResolveCounters("counter2", ",", CounterDigitsGlyphStyle.DEFAULT
                                                                         ));
            manager.PopEveryCounterFromCounters(node1);
        }