Ejemplo n.º 1
0
        public void ParseLiteral_Null_Throws()
        {
            // arrange
            var type = new ByteType();

            // act
            // assert
            Assert.Throws <ArgumentNullException>(
                () => type.ParseLiteral(null));
        }
Ejemplo n.º 2
0
        public void ParseLiteral_NullValueNode()
        {
            // arrange
            var type = new ByteType();

            // act
            var output = type.ParseLiteral(NullValueNode.Default);

            // assert
            Assert.Null(output);
        }
Ejemplo n.º 3
0
        public void ParseLiteral_Wrong_ValueNode_Throws()
        {
            // arrange
            var type  = new ByteType();
            var input = new StringValueNode("abc");

            // act
            // assert
            Assert.Throws <SerializationException>(
                () => type.ParseLiteral(input));
        }
Ejemplo n.º 4
0
        public void ParseLiteral_IntLiteral()
        {
            // arrange
            var type    = new ByteType();
            var literal = new IntValueNode(1);

            // act
            var value = type.ParseLiteral(literal);

            // assert
            Assert.IsType <byte>(value);
            Assert.Equal(literal.ToByte(), value);
        }