Exemplo n.º 1
0
        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));
        }
Exemplo n.º 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));
        }
Exemplo n.º 3
0
        public void ParseLiteral_NullValueNode()
        {
            // arrange
            UrlType       urlType = new UrlType();
            NullValueNode literal = NullValueNode.Default;

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

            // assert
            Assert.Null(value);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }