Exemplo n.º 1
0
        public void PopTest()
        {
            var root = new JsonPointer();

            root.Push(1);
            Assert.Equal("#/1", root.Text);
            Assert.Equal(root.Text, root.ToString());

            root.Push(2);
            Assert.Equal("#/1/2", root.Text);
            Assert.Equal(root.Text, root.ToString());

            root.Push(0);
            Assert.Equal("#/1/2/0", root.Text);
            Assert.Equal(root.Text, root.ToString());

            root.Pop();
            Assert.Equal("#/1/2", root.Text);
            Assert.Equal(root.Text, root.ToString());

            root.Pop();
            root.Push(3);
            Assert.Equal("#/1/3", root.Text);
            Assert.Equal(root.Text, root.ToString());

            root.Pop();
            root.Pop();
            Assert.Equal("#/", root.Text);
            Assert.Equal(root.Text, root.ToString());
        }