public void TestDeserializeIntSchema()
 {
     IValueSchema<int?> schema = new IntSchema
     {
         AllowNull = false,
         DefaultValue = 10,
         MaxValue = 100,
         MinValue = 2,
         PossibleValues = new int?[] { 10, 20, 30, 100 }
     };
     JsonSchemaSerializationVisitor visitor = new JsonSchemaSerializationVisitor();
     schema.Accept(visitor);
     IValueSchema<object> vs = JsonSchemaDeserializer.Deserialize(visitor.SchemaType, visitor.JsonValue);
     Assert.IsNotNull(vs);
     Assert.AreEqual(typeof(int?), vs.Type);
 }
 public void TestSerializeIntSchema()
 {
     IValueSchema<int?> schema = new IntSchema
                                     {
                                         AllowNull = false,
                                         DefaultValue = 10,
                                         MaxValue = 100,
                                         MinValue = 2,
                                         PossibleValues = new int?[] {10, 20, 30, 100}
                                     };
     JsonSchemaSerializationVisitor visitor = new JsonSchemaSerializationVisitor();
     schema.Accept(visitor);
     Assert.AreEqual(typeof(int?), visitor.ValueType);
     Assert.AreEqual(typeof(IntSchema), visitor.SchemaType);
     Assert.IsNotNull(visitor.JsonValue);
     Assert.AreNotEqual(0, visitor.JsonValue.Length);
 }
        public void TestDeserializeIntSchema()
        {
            IValueSchema <int?> schema = new IntSchema
            {
                AllowNull      = false,
                DefaultValue   = 10,
                MaxValue       = 100,
                MinValue       = 2,
                PossibleValues = new int?[] { 10, 20, 30, 100 }
            };
            SchemaJsonSerializationVisitor visitor = new SchemaJsonSerializationVisitor();

            schema.Accept(visitor);
            IValueSchema <object> vs = JsonSchemaDeserializer.Deserialize(visitor.SchemaType, visitor.JsonValue);

            Assert.IsNotNull(vs);
            Assert.AreEqual(typeof(int?), vs.Type);
        }
        public void TestSerializeIntSchema()
        {
            IValueSchema <int?> schema = new IntSchema
            {
                AllowNull      = false,
                DefaultValue   = 10,
                MaxValue       = 100,
                MinValue       = 2,
                PossibleValues = new int?[] { 10, 20, 30, 100 }
            };
            SchemaJsonSerializationVisitor visitor = new SchemaJsonSerializationVisitor();

            schema.Accept(visitor);
            Assert.AreEqual(typeof(int?), visitor.ValueType);
            Assert.AreEqual(typeof(IntSchema), visitor.SchemaType);
            Assert.IsNotNull(visitor.JsonValue);
            Assert.AreNotEqual(0, visitor.JsonValue.Length);
        }