Пример #1
0
        public void HtmlTokenizer_GetNameToken_BasicTest()
        {
            var           cs     = new HtmlCharStream("foo");
            HtmlTokenizer target = new HtmlTokenizer(cs);
            NameToken     actual = target.GetNameToken();

            Assert.Equal(3, actual.Length);
            Assert.Equal(0, actual.Start);
            Assert.Equal(3, actual.End);

            Assert.Equal(3, actual.NameRange.Length);
            Assert.Equal(0, actual.NameRange.Start);
            Assert.Equal(3, actual.NameRange.End);

            Assert.Equal(0, actual.PrefixRange.Start);
            Assert.Equal(0, actual.PrefixRange.End);
        }
Пример #2
0
        public void HtmlTokenizer_GetNameToken_MissingNameTest()
        {
            var           cs     = new HtmlCharStream("foo:");
            HtmlTokenizer target = new HtmlTokenizer(cs);
            NameToken     actual = target.GetNameToken();

            Assert.Equal(4, actual.Length);
            Assert.Equal(0, actual.Start);
            Assert.Equal(4, actual.End);

            Assert.True(actual.HasPrefix());
            Assert.Equal(0, actual.PrefixRange.Start);
            Assert.Equal(3, actual.PrefixRange.End);

            Assert.False(actual.HasName());
            Assert.Equal(0, actual.NameRange.Length);

            Assert.False(actual.HasQualifiedName());
            Assert.Equal(0, actual.QualifiedName.Start);
            Assert.Equal(4, actual.QualifiedName.End);
        }