public void TestStringDeSerializeProperties() { JsonPropertySerializer serializer = new JsonPropertySerializer(new PropertySchemaFactory()); StringSchema schema = new StringSchema { MaxLength = 100, MinLength = 1, DefaultValue = "hello" }; PropertyElement element = serializer.Serialize("hello", schema.Wrap()); Assert.IsNotNull(element); Assert.AreEqual(typeof(StringSchema).FullName, element.Schema.SchemaType); Assert.AreEqual(SerializationTypeHint.String, element.SerializationHint); Assert.AreEqual("hello", element.Value); IValueSchema <object> vs = serializer.DeserializeSchema(element.Schema); Assert.IsNotNull(vs); IValueSchema <string> strSchema = vs.UnwrapRefType <string>(); Assert.IsNotNull(strSchema); }
public void TestStringDeSerializeProperties() { JsonPropertySerializer serializer = new JsonPropertySerializer(new PropertySchemaFactory()); StringSchema schema = new StringSchema { MaxLength = 100, MinLength = 1, DefaultValue = "hello" }; PropertyElement element = serializer.Serialize("hello", schema.Wrap()); Assert.IsNotNull(element); Assert.AreEqual(typeof(StringSchema).FullName, element.Schema.SchemaType); Assert.AreEqual(SerializationTypeHint.String, element.SerializationHint); Assert.AreEqual("hello", element.Value); IValueSchema<object> vs = serializer.DeserializeSchema(element.Schema); Assert.IsNotNull(vs); IValueSchema<string> strSchema = vs.UnwrapRefType<string>(); Assert.IsNotNull(strSchema); }