示例#1
0
        public void Parse_StringUrlIsBad()
        {
            var expected = "</Testing>";

            Action action = () => HeaderLinkUrl.Parse(expected);

            action.Should().Throw <FormatException>();
        }
示例#2
0
        public void Parse_StringUrlIsValid()
        {
            var expected = "http://www.google.com";

            var actual = HeaderLinkUrl.Parse($"<{expected}>");

            actual.Url.ToString().TrimEnd('/').Should().BeEquivalentTo(expected.TrimEnd('/'));
        }
示例#3
0
        public void Parse_StringUrlWithMultipleRelation()
        {
            var expectedUrl       = "http://www.google.com";
            var expectedRelations = new[] { StandardLinkTypes.Next, StandardLinkTypes.Alternate };

            var actual = HeaderLinkUrl.Parse($"<{expectedUrl}>;rel=\"{String.Join(" ", expectedRelations)}\"");

            actual.Url.ToString().TrimEnd('/').Should().BeEquivalentTo(expectedUrl.TrimEnd('/'));
            actual.Relations.Should().Contain(expectedRelations);
        }
示例#4
0
        public void Parse_StringUrlWithRelation()
        {
            var expectedUrl      = "http://www.google.com";
            var expectedRelation = "next";

            var actual = HeaderLinkUrl.Parse($"<{expectedUrl}>;rel=\"{expectedRelation}\"");

            actual.Url.ToString().TrimEnd('/').Should().BeEquivalentTo(expectedUrl.TrimEnd('/'));
            actual.Relation.Should().Be(expectedRelation);
        }
示例#5
0
        public void Parse_StringUrlIsBadFormat()
        {
            Action action = () => HeaderLinkUrl.Parse(@"D:\/\Temp\/f\test.dat");

            action.Should().Throw <FormatException>();
        }
示例#6
0
        public void Parse_StringUrlIsEmpty()
        {
            Action action = () => HeaderLinkUrl.Parse("");

            action.Should().Throw <ArgumentException>();
        }
示例#7
0
        public void Parse_StringUrlIsNull()
        {
            Action action = () => HeaderLinkUrl.Parse((string)null);

            action.Should().Throw <ArgumentNullException>();
        }