ReadIndentationToken() публичный Метод

public ReadIndentationToken ( IProjectNode node ) : Token
node IProjectNode
Результат Token
Пример #1
0
        public void TestIndentationLevelVerification()
        {
            Mockery mockery = new Mockery();
            IProjectNode pn = mockery.NewMock<IProjectNode>();
            ProjectSerializer ps = new ProjectSerializer("\tged\r\n\t  hest \r\n\tnejj\r\n", null, null);
            ps.SpacesIndent = 2;

            Token t = ps.ReadIndentationToken(pn);

            Assert.AreEqual(TokenType.Indentation, t.Type);
            Assert.AreEqual("\t", t.Text);

            t = ps.ReadTextToken(pn);

            Assert.AreEqual(TokenType.Text, t.Type);
            Assert.AreEqual("ged", t.Text);

            t = ps.ReadLineBreakToken(pn);

            t = ps.ReadIndentationToken(pn);

            Assert.AreEqual(TokenType.Indentation, t.Type);
            Assert.AreEqual("\t  ", t.Text);
            Assert.AreEqual(2, ps.GetIndentationLevel(t.Text));

            t = ps.ReadTextToken(pn);

            Assert.AreEqual(TokenType.Text, t.Type);
            Assert.AreEqual("hest", t.Text);

            t = ps.ReadLineBreakToken(pn);

            t = ps.ReadIndentationToken(pn);

            Assert.AreEqual(TokenType.Indentation, t.Type);
            Assert.AreEqual("\t", t.Text);
            Assert.AreEqual(1, ps.GetIndentationLevel(t.Text));

            ps.RollBackToken(t);

            t = ps.ReadIndentationToken(pn);

            Assert.AreEqual(TokenType.Indentation, t.Type);
            Assert.AreEqual("\t", t.Text);
            Assert.AreEqual(1, ps.GetIndentationLevel(t.Text));
        }