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

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

            action.Should().Throw <FormatException>();
        }
Example #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('/'));
        }
Example #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);
        }
Example #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);
        }
Example #5
0
        public void Parse_StringUrlIsBadFormat()
        {
            Action action = () => HeaderLinkUrl.Parse(@"D:\/\Temp\/f\test.dat");

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

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

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