-Fixed test

This commit is contained in:
James Newton-King
2014-09-11 15:34:20 +12:00
parent 7fcd12e2cf
commit 2fc8638d59
6 changed files with 22 additions and 3 deletions
+1
View File
@@ -14,6 +14,7 @@
*.jpg binary
*.png binary
*.gif binary
*.bson binary
*.cs text diff=csharp
*.vb text
@@ -58,7 +58,7 @@ namespace Newtonsoft.Json.Tests.Bson
[Test]
public void DeserializeLargeBsonObject()
{
byte[] data = System.IO.File.ReadAllBytes(@"SpaceShipV2.baemf");
byte[] data = System.IO.File.ReadAllBytes(@"SpaceShipV2.bson");
MemoryStream ms = new MemoryStream(data);
BsonReader reader = new BsonReader(ms);
@@ -486,7 +486,7 @@
<None Include="Schema\Specs\uniqueItems.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<Content Include="SpaceShipV2.baemf">
<Content Include="SpaceShipV2.bson">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
@@ -27,6 +27,7 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text.RegularExpressions;
#if NET20
using Newtonsoft.Json.Serialization;
#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 void Throws<TException>(string message, Action action)
+2 -1
View File
@@ -724,7 +724,8 @@ namespace Newtonsoft.Json.Linq
{
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)