-Fixed unit test failing because of timezones
-Added IsValid overload that returns a list of error messages
This commit is contained in:
@@ -39,8 +39,8 @@ namespace Newtonsoft.Json.Tests
|
||||
|
||||
public class PerformanceTests : TestFixtureBase
|
||||
{
|
||||
//private const int Iterations = 100;
|
||||
private const int Iterations = 5000;
|
||||
private const int Iterations = 100;
|
||||
//private const int Iterations = 5000;
|
||||
|
||||
#region Data
|
||||
|
||||
|
||||
@@ -47,8 +47,15 @@ namespace Newtonsoft.Json.Tests.Schema
|
||||
JToken stringToken = JToken.FromObject("pie");
|
||||
JToken integerToken = JToken.FromObject(1);
|
||||
|
||||
Assert.AreEqual(false, stringToken.IsValid(schema));
|
||||
IList<string> errorMessages;
|
||||
Assert.AreEqual(true, integerToken.IsValid(schema));
|
||||
Assert.AreEqual(true, integerToken.IsValid(schema, out errorMessages));
|
||||
Assert.AreEqual(0, errorMessages.Count);
|
||||
|
||||
Assert.AreEqual(false, stringToken.IsValid(schema));
|
||||
Assert.AreEqual(false, stringToken.IsValid(schema, out errorMessages));
|
||||
Assert.AreEqual(1, errorMessages.Count);
|
||||
Assert.AreEqual("Invalid type. Expected Integer but got String.", errorMessages[0]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -856,6 +856,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
public void ByteArrays()
|
||||
{
|
||||
Car testerObject = new Car();
|
||||
testerObject.Year = new DateTime(2000, 10, 5, 1, 1, 1, DateTimeKind.Utc);
|
||||
byte[] data = new byte[] {75, 65, 82, 73, 82, 65};
|
||||
testerObject.Objects = new object[] { data, "prueba" };
|
||||
|
||||
@@ -869,7 +870,7 @@ namespace Newtonsoft.Json.Tests.Serialization
|
||||
|
||||
Assert.AreEqual(output, @"{
|
||||
""$type"": """ + carClassRef + @""",
|
||||
""Year"": ""\/Date(-62135596800000+1300)\/"",
|
||||
""Year"": ""\/Date(970707661000)\/"",
|
||||
""Objects"": {
|
||||
""$type"": ""System.Object[], mscorlib"",
|
||||
""$values"": [
|
||||
|
||||
Reference in New Issue
Block a user