public void TestStringDeSerializeProperties() { JsonPropertySerializer serializer = new JsonPropertySerializer(new PropertySchemaFactory()); StringSchema schema = new StringSchema { MaxLength = 100, MinLength = 1, DefaultValue = "hello" }; PropertyElement element = serializer.Serialize("key", "hello", schema.Wrap()); Assert.IsNotNull(element); Assert.AreEqual(typeof(StringSchema).FullName, element.SchemaType); Assert.AreEqual(SerializationValueType.String, element.SerializationValueType); Assert.AreEqual("hello", element.ValString); IValueSchema<object> vs; object value = serializer.Deserialize(element, out vs); Assert.IsNotNull(vs); Assert.IsNotNull(value); IValueSchema<string> strSchema = vs.UnwrapRefType<string>(); Assert.IsNotNull(strSchema); }
public void TestStringSerializeProperties() { JsonPropertySerializer serializer=new JsonPropertySerializer(new PropertySchemaFactory()); StringSchema schema=new StringSchema{MaxLength = 100,MinLength = 1, DefaultValue = "hello"}; PropertyElement element = serializer.Serialize("key", "hello", schema.Wrap()); Assert.IsNotNull(element); Assert.AreEqual(typeof(StringSchema).FullName,element.SchemaType); Assert.AreEqual(SerializationValueType.String,element.SerializationValueType); Assert.AreEqual("hello",element.ValString); }