public void ReadAsDecimal()
    {
      JsonSchema s = new JsonSchemaGenerator().Generate(typeof (decimal));

      JsonReader reader = new JsonValidatingReader(new JsonTextReader(new StringReader(@"1.5")))
        {
          Schema = s
        };
      decimal? d = reader.ReadAsDecimal();

      Assert.AreEqual(1.5m, d);
    }
    public void ReadAsDecimalFailure()
    {
      ExceptionAssert.Throws<JsonSchemaException>("Float 5.5 is not evenly divisible by 1. Line 1, position 3.",
      () =>
      {
        JsonSchema s = new JsonSchemaGenerator().Generate(typeof(decimal));
        s.DivisibleBy = 1;

        JsonReader reader = new JsonValidatingReader(new JsonTextReader(new StringReader(@"5.5")))
        {
          Schema = s
        };
        reader.ReadAsDecimal();
      });
    }
    public void ReadAsDecimalFailure()
    {
      JsonSchema s = new JsonSchemaGenerator().Generate(typeof (decimal));
      s.DivisibleBy = 1;

      JsonReader reader = new JsonValidatingReader(new JsonTextReader(new StringReader(@"5.5")))
        {
          Schema = s
        };
      reader.ReadAsDecimal();
    }