public void ParseLiteral_Null_Throws()
        {
            // arrange
            var type = new FloatType();

            // act
            // assert
            Assert.Throws <ArgumentNullException>(
                () => type.ParseLiteral(null));
        }
        public void ParseLiteral_Wrong_ValueNode_Throws()
        {
            // arrange
            var type  = new FloatType();
            var input = new StringValueNode("abc");

            // act
            // assert
            Assert.Throws <ScalarSerializationException>(
                () => type.ParseLiteral(input));
        }
        public void ParseLiteral_NullValueNode()
        {
            // arrange
            var type = new FloatType();

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

            // assert
            Assert.Null(output);
        }
Exemple #4
0
        public void ParseLiteral_NullValueNode()
        {
            // arrange
            FloatType     type  = new FloatType();
            NullValueNode input = new NullValueNode();

            // act
            object output = type.ParseLiteral(input);

            // assert
            Assert.Null(output);
        }
        public void ParseLiteral_IntLiteral()
        {
            // arrange
            var type    = new FloatType();
            var literal = new IntValueNode(123);

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

            // assert
            Assert.IsType <double>(value);
            Assert.Equal(literal.ToDouble(), value);
        }
        public void ParseLiteral_ExponentialLiteral()
        {
            // arrange
            var            type    = new FloatType();
            FloatValueNode literal = CreateExponentialLiteral();

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

            // assert
            Assert.IsType <double>(value);
            Assert.Equal(literal.ToDouble(), value);
        }
Exemple #7
0
        public void ParseLiteral_FloatValueNode()
        {
            // arrange
            FloatType      type  = new FloatType();
            FloatValueNode input = new FloatValueNode("1.000000e+000");

            // act
            object output = type.ParseLiteral(input);

            // assert
            Assert.IsType <double>(output);
            Assert.Equal(1.0d, output);
        }