-Fixed test
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
*.jpg binary
|
*.jpg binary
|
||||||
*.png binary
|
*.png binary
|
||||||
*.gif binary
|
*.gif binary
|
||||||
|
*.bson binary
|
||||||
|
|
||||||
*.cs text diff=csharp
|
*.cs text diff=csharp
|
||||||
*.vb text
|
*.vb text
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ namespace Newtonsoft.Json.Tests.Bson
|
|||||||
[Test]
|
[Test]
|
||||||
public void DeserializeLargeBsonObject()
|
public void DeserializeLargeBsonObject()
|
||||||
{
|
{
|
||||||
byte[] data = System.IO.File.ReadAllBytes(@"SpaceShipV2.baemf");
|
byte[] data = System.IO.File.ReadAllBytes(@"SpaceShipV2.bson");
|
||||||
|
|
||||||
MemoryStream ms = new MemoryStream(data);
|
MemoryStream ms = new MemoryStream(data);
|
||||||
BsonReader reader = new BsonReader(ms);
|
BsonReader reader = new BsonReader(ms);
|
||||||
|
|||||||
@@ -486,7 +486,7 @@
|
|||||||
<None Include="Schema\Specs\uniqueItems.json">
|
<None Include="Schema\Specs\uniqueItems.json">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
<Content Include="SpaceShipV2.baemf">
|
<Content Include="SpaceShipV2.bson">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
#if NET20
|
#if NET20
|
||||||
using Newtonsoft.Json.Serialization;
|
using Newtonsoft.Json.Serialization;
|
||||||
#else
|
#else
|
||||||
@@ -172,6 +173,22 @@ namespace Newtonsoft.Json.Tests
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class StringAssert
|
||||||
|
{
|
||||||
|
private readonly static Regex Regex = new Regex(@"\r\n|\n\r|\n|\r", RegexOptions.CultureInvariant | RegexOptions.Compiled);
|
||||||
|
|
||||||
|
public static void AreEqual(string expected, string actual)
|
||||||
|
{
|
||||||
|
if (expected != null)
|
||||||
|
expected = Regex.Replace(expected, "\r\n");
|
||||||
|
|
||||||
|
if (actual != null)
|
||||||
|
actual = Regex.Replace(actual, "\r\n");
|
||||||
|
|
||||||
|
Assert.AreEqual(expected, actual);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static class ExceptionAssert
|
public static class ExceptionAssert
|
||||||
{
|
{
|
||||||
public static void Throws<TException>(string message, Action action)
|
public static void Throws<TException>(string message, Action action)
|
||||||
|
|||||||
@@ -724,7 +724,8 @@ namespace Newtonsoft.Json.Linq
|
|||||||
{
|
{
|
||||||
int valueHashCode = (_value != null) ? _value.GetHashCode() : 0;
|
int valueHashCode = (_value != null) ? _value.GetHashCode() : 0;
|
||||||
|
|
||||||
return _valueType.GetHashCode() ^ valueHashCode;
|
// GetHashCode on an enum boxes so cast to int
|
||||||
|
return ((int)_valueType).GetHashCode() ^ valueHashCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool ValuesEquals(JValue v1, JValue v2)
|
private static bool ValuesEquals(JValue v1, JValue v2)
|
||||||
|
|||||||
Reference in New Issue
Block a user