diff --git a/.gitattributes b/.gitattributes index efbd36b9..47331e34 100644 --- a/.gitattributes +++ b/.gitattributes @@ -14,6 +14,7 @@ *.jpg binary *.png binary *.gif binary +*.bson binary *.cs text diff=csharp *.vb text diff --git a/Src/Newtonsoft.Json.Tests/Bson/BsonReaderTests.cs b/Src/Newtonsoft.Json.Tests/Bson/BsonReaderTests.cs index 624d6be3..bdda8102 100644 --- a/Src/Newtonsoft.Json.Tests/Bson/BsonReaderTests.cs +++ b/Src/Newtonsoft.Json.Tests/Bson/BsonReaderTests.cs @@ -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); diff --git a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj index f6263a68..ae9f9335 100644 --- a/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj +++ b/Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj @@ -486,7 +486,7 @@ Always - + PreserveNewest diff --git a/Src/Newtonsoft.Json.Tests/SpaceShipV2.baemf b/Src/Newtonsoft.Json.Tests/SpaceShipV2.bson similarity index 100% rename from Src/Newtonsoft.Json.Tests/SpaceShipV2.baemf rename to Src/Newtonsoft.Json.Tests/SpaceShipV2.bson diff --git a/Src/Newtonsoft.Json.Tests/TestFixtureBase.cs b/Src/Newtonsoft.Json.Tests/TestFixtureBase.cs index 5717f195..b2971e58 100644 --- a/Src/Newtonsoft.Json.Tests/TestFixtureBase.cs +++ b/Src/Newtonsoft.Json.Tests/TestFixtureBase.cs @@ -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(string message, Action action) diff --git a/Src/Newtonsoft.Json/Linq/JValue.cs b/Src/Newtonsoft.Json/Linq/JValue.cs index 4c21afd5..ad24700c 100644 --- a/Src/Newtonsoft.Json/Linq/JValue.cs +++ b/Src/Newtonsoft.Json/Linq/JValue.cs @@ -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)