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

            // act
            // assert
            Assert.Throws <ArgumentNullException>(() => type.ParseLiteral(null));
        }
        public void IsInstanceOfType_Null_Throws()
        {
            // arrange
            var type = new MultiplierPathType();

            // act
            // assert
            Assert.Throws <ArgumentNullException>(
                () => type.IsInstanceOfType(null));
        }
        public void EnsureStringTypeKindIsCorret()
        {
            // arrange
            var type = new MultiplierPathType();

            // act
            TypeKind kind = type.Kind;

            // assert
            Assert.Equal(TypeKind.Scalar, type.Kind);
        }
        public void ParseValue_Wrong_Value_Throws()
        {
            // arrange
            var    type  = new MultiplierPathType();
            object input = 123456;

            // act
            // assert
            Assert.Throws <ScalarSerializationException>(
                () => type.ParseValue(input));
        }
        public void ParseLiteral_Wrong_ValueNode_Throws()
        {
            // arrange
            var type  = new MultiplierPathType();
            var input = new IntValueNode(123456);

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

            // act
            object serializedValue = type.Serialize(null);

            // assert
            Assert.Null(serializedValue);
        }
Exemplo n.º 7
0
        public void Serialize_Wrong_Type_Throws()
        {
            // arrange
            var    type  = new MultiplierPathType();
            object input = 123456;

            // act
            // assert
            Assert.Throws <SerializationException>(
                () => type.Serialize(input));
        }
        public void IsInstanceOfType_Wrong_StringValue(string s)
        {
            // arrange
            var type  = new MultiplierPathType();
            var input = new StringValueNode(s);

            // act
            bool result = type.IsInstanceOfType(input);

            // assert
            Assert.False(result);
        }
        public void IsInstanceOfType_Wrong_ValueNode()
        {
            // arrange
            var type  = new MultiplierPathType();
            var input = new IntValueNode(123456);

            // act
            bool result = type.IsInstanceOfType(input);

            // assert
            Assert.False(result);
        }
        public void IsInstanceOfType_NullValueNode()
        {
            // arrange
            var           type  = new MultiplierPathType();
            NullValueNode input = NullValueNode.Default;

            // act
            bool result = type.IsInstanceOfType(input);

            // assert
            Assert.True(result);
        }
        public void IsInstanceOfType_ValueNode()
        {
            // arrange
            var type  = new MultiplierPathType();
            var input = new StringValueNode("_123.456");

            // act
            bool result = type.IsInstanceOfType(input);

            // assert
            Assert.True(result);
        }
        public void ParseValue_Null()
        {
            // arrange
            var    type  = new MultiplierPathType();
            object input = null;

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

            // assert
            Assert.IsType <NullValueNode>(output);
        }
        public void ParseLiteral_NullValueNode()
        {
            // arrange
            var           type  = new MultiplierPathType();
            NullValueNode input = NullValueNode.Default;

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

            // assert
            Assert.Null(output);
        }
        public void Serialize_Type()
        {
            // arrange
            var type = new MultiplierPathType();
            MultiplierPathString input = "_123456";

            // act
            object serializedValue = type.Serialize(input);

            // assert
            Assert.IsType <string>(serializedValue);
            Assert.Equal("_123456", serializedValue);
        }
        public void ParseLiteral_ValueNode()
        {
            // arrange
            var type  = new MultiplierPathType();
            var input = new StringValueNode("__123456");

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

            // assert
            Assert.IsType <MultiplierPathString>(output);
            Assert.Equal(new MultiplierPathString("__123456"), output);
        }