public void ParseLiteral_Invalid_Url_Throws()
        {
            // arrange
            UrlType         type  = new UrlType();
            StringValueNode input = new StringValueNode("$*^domain.test");

            // act
            // assert
            Assert.Throws <ArgumentException>(() => type.ParseLiteral(input));
        }
Example #2
0
        public void ParseLiteral_Invalid_Url_Throws()
        {
            // arrange
            var type  = new UrlType();
            var input = new StringValueNode("$*^domain.test");

            // act
            // assert
            Assert.Throws <SerializationException>(
                () => type.ParseLiteral(input));
        }
        public void ParseLiteral_NullValueNode()
        {
            // arrange
            UrlType       urlType = new UrlType();
            NullValueNode literal = NullValueNode.Default;

            // act
            object value = urlType.ParseLiteral(literal);

            // assert
            Assert.Null(value);
        }
Example #4
0
        public void ParseLiteral_RelativeUrl()
        {
            // arrange
            var urlType  = new UrlType();
            var expected = new Uri("/relative/path", UriKind.Relative);
            var literal  = new StringValueNode($"{expected}");

            // act
            var actual = (Uri)urlType.ParseLiteral(literal);

            // Assert
            Assert.Equal(expected, actual);
        }
Example #5
0
        public void ParseLiteral_StringValueNode()
        {
            // arrange
            var urlType  = new UrlType();
            var expected = new Uri("http://domain.test/url");
            var literal  = new StringValueNode(expected.AbsoluteUri);

            // act
            var actual = (Uri)urlType.ParseLiteral(literal);

            // assert
            Assert.Equal(expected, actual);
        }