示例#1
0
        public void Parse1()
        {
            var link = LinkHeader.Parse("</>;rel=\"index\"");

            Assert.Equal("/", link.Url.OriginalString);

            var rel = link.Items["REL"];

            Assert.NotNull(rel);
            Assert.Equal("rel", rel.Name);
            Assert.Equal("index", rel.Value);
            Assert.True(rel.Quoted);
        }
示例#2
0
        public void Parse3()
        {
            var link = LinkHeader.Parse("</TheBook/chapter2>; rel=\"previous\"; title*=UTF-8'de'letztes%20Kapitel");

            Assert.Equal("/TheBook/chapter2", link.Url.OriginalString);

            var rel = link.Items["rel"];

            Assert.NotNull(rel);
            Assert.Equal("rel", rel.Name);
            Assert.Equal("previous", rel.Value);
            Assert.True(rel.Quoted);

            var title = link.Items["title*"];

            Assert.NotNull(title);
            Assert.Equal("title*", title.Name);
            Assert.Equal("UTF-8'de'letztes%20Kapitel", title.Value);
            Assert.True(rel.Quoted);
        }
示例#3
0
        public void Parse2()
        {
            var link = LinkHeader.Parse("<http://example.com/TheBook/chapter2>; rel=\"previous\"; title=\"previous chapter\"");

            Assert.Equal("http://example.com/TheBook/chapter2", link.Url.OriginalString);

            var rel = link.Items["rel"];

            Assert.NotNull(rel);
            Assert.Equal("rel", rel.Name);
            Assert.Equal("previous", rel.Value);
            Assert.True(rel.Quoted);

            var title = link.Items["title"];

            Assert.NotNull(title);
            Assert.Equal("title", title.Name);
            Assert.Equal("previous chapter", title.Value);
            Assert.True(rel.Quoted);
        }