-Added INotifyCollectionChanged to JContainer in .NET 4.0 build

-Changed .NET 3.5 and .NET 4.0 builds to target client frameworks
-Fixed JSON Schema not raising an error for additional properties when the schema has no properties
This commit is contained in:
JamesNK
2010-09-11 22:56:13 +00:00
parent 43501484fb
commit 11ce71ee8b
8 changed files with 57 additions and 26 deletions
@@ -1305,9 +1305,10 @@ Parameter name: arrayIndex")]
Assert.AreEqual(index, 0);
Assert.AreEqual(2, (int)o["Test1"]);
}
#else
#endif
#if SILVERLIGHT || !(NET20 || NET35)
[Test]
public void ListChanged()
public void CollectionChanged()
{
JProperty p1 = new JProperty("Test1", 1);
JProperty p2 = new JProperty("Test2", "Two");
@@ -197,5 +197,25 @@ namespace Newtonsoft.Json.Tests.Schema
GenerateSchemaAndSerializeFromType(DBNull.Value);
GenerateSchemaAndSerializeFromType(new JsonPropertyWithHandlingValues());
}
[Test]
public void UndefinedPropertyOnNoPropertySchema()
{
JsonSchema schema = JsonSchema.Parse(@"{
""description"": ""test"",
""type"": ""object"",
""additionalProperties"": false,
""properties"": {
}
}");
JObject o = JObject.Parse("{'g':1}");
List<string> errors = new List<string>();
o.Validate(schema, (sender, args) => errors.Add(args.Message));
Assert.AreEqual(1, errors.Count);
Assert.AreEqual("Property 'g' has not been defined and the schema does not allow additional properties. Line 1, position 5.", errors[0]);
}
}
}