Permalink
Browse files

-Added Newtonsoft.Json.Metro build (whew, what a pain!)

-Added .gitignore file
  • Loading branch information...
1 parent f9e5745 commit 5800e97ff36d3dacea20ec75e80ebfa5f76100cd @JamesNK JamesNK committed Mar 15, 2012
Showing with 3,927 additions and 1,103 deletions.
  1. +5 −0 .gitignore
  2. +64 −0 Src/Newtonsoft.Json.Metro.sln
  3. +37 −27 Src/Newtonsoft.Json.Tests/Bson/BsonReaderTests.cs
  4. +54 −32 Src/Newtonsoft.Json.Tests/Bson/BsonWriterTests.cs
  5. +13 −6 Src/Newtonsoft.Json.Tests/Converters/BinaryConverterTests.cs
  6. +7 −0 Src/Newtonsoft.Json.Tests/Converters/CustomCreationConverterTests.cs
  7. +7 −1 Src/Newtonsoft.Json.Tests/Converters/DataSetConverterTests.cs
  8. +9 −1 Src/Newtonsoft.Json.Tests/Converters/DataTableConverterTests.cs
  9. +17 −10 Src/Newtonsoft.Json.Tests/Converters/ExpandoObjectConverterTests.cs
  10. +14 −4 Src/Newtonsoft.Json.Tests/Converters/IsoDateTimeConverterTests.cs
  11. +13 −3 Src/Newtonsoft.Json.Tests/Converters/JavaScriptDateTimeConverterTests.cs
  12. +9 −2 Src/Newtonsoft.Json.Tests/Converters/ObjectIdConverterTests.cs
  13. +9 −2 Src/Newtonsoft.Json.Tests/Converters/RegexConverterTests.cs
  14. +15 −5 Src/Newtonsoft.Json.Tests/Converters/StringEnumConverterTests.cs
  15. +7 −0 Src/Newtonsoft.Json.Tests/Converters/VersionConverterTests.cs
  16. +8 −1 Src/Newtonsoft.Json.Tests/Converters/XmlNodeConverterTest.cs
  17. +7 −0 Src/Newtonsoft.Json.Tests/ExceptionTests.cs
  18. BIN Src/Newtonsoft.Json.Tests/Images/UnitTestLogo.png
  19. BIN Src/Newtonsoft.Json.Tests/Images/UnitTestSmallLogo.png
  20. BIN Src/Newtonsoft.Json.Tests/Images/UnitTestSplashScreen.png
  21. BIN Src/Newtonsoft.Json.Tests/Images/UnitTestStoreLogo.png
  22. +7 −0 Src/Newtonsoft.Json.Tests/JsonArrayAttributeTests.cs
  23. +26 −9 Src/Newtonsoft.Json.Tests/JsonConvertTest.cs
  24. +182 −55 Src/Newtonsoft.Json.Tests/JsonTextReaderTest.cs
  25. +22 −3 Src/Newtonsoft.Json.Tests/JsonTextWriterTest.cs
  26. +33 −17 Src/Newtonsoft.Json.Tests/JsonValidatingReaderTests.cs
  27. +2 −1 Src/Newtonsoft.Json.Tests/Linq/ComponentModel/BindingTests.cs
  28. +2 −1 Src/Newtonsoft.Json.Tests/Linq/ComponentModel/JPropertyDescriptorTests.cs
  29. +74 −63 Src/Newtonsoft.Json.Tests/Linq/DynamicTests.cs
  30. +74 −19 Src/Newtonsoft.Json.Tests/Linq/JArrayTests.cs
  31. +13 −3 Src/Newtonsoft.Json.Tests/Linq/JConstructorTests.cs
  32. +189 −100 Src/Newtonsoft.Json.Tests/Linq/JObjectTests.cs
  33. +58 −11 Src/Newtonsoft.Json.Tests/Linq/JPathTests.cs
  34. +28 −5 Src/Newtonsoft.Json.Tests/Linq/JPropertyTests.cs
  35. +8 −1 Src/Newtonsoft.Json.Tests/Linq/JRawTests.cs
  36. +7 −0 Src/Newtonsoft.Json.Tests/Linq/JTokenEqualityComparerTests.cs
  37. +58 −24 Src/Newtonsoft.Json.Tests/Linq/JTokenReaderTest.cs
  38. +25 −8 Src/Newtonsoft.Json.Tests/Linq/JTokenTests.cs
  39. +8 −1 Src/Newtonsoft.Json.Tests/Linq/JTokenWriterTest.cs
  40. +56 −26 Src/Newtonsoft.Json.Tests/Linq/JValueTests.cs
  41. +32 −16 Src/Newtonsoft.Json.Tests/Linq/LinqToJsonTest.cs
  42. +320 −0 Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Metro.csproj
  43. BIN Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.Metro_TemporaryKey.pfx
  44. +54 −0 Src/Newtonsoft.Json.Tests/Package.appxmanifest
  45. +6 −5 Src/Newtonsoft.Json.Tests/PerformanceTests.cs
  46. +1 −1 Src/Newtonsoft.Json.Tests/Properties/AssemblyInfo.cs
  47. +67 −40 Src/Newtonsoft.Json.Tests/Schema/ExtensionsTests.cs
  48. +14 −4 Src/Newtonsoft.Json.Tests/Schema/JsonSchemaBuilderTests.cs
  49. +17 −5 Src/Newtonsoft.Json.Tests/Schema/JsonSchemaGeneratorTests.cs
  50. +7 −0 Src/Newtonsoft.Json.Tests/Schema/JsonSchemaModelBuilderTests.cs
  51. +7 −0 Src/Newtonsoft.Json.Tests/Schema/JsonSchemaNodeTests.cs
  52. +7 −0 Src/Newtonsoft.Json.Tests/Schema/JsonSchemaTests.cs
  53. +9 −0 Src/Newtonsoft.Json.Tests/Serialization/CamelCasePropertyNamesContractResolverTests.cs
  54. +14 −3 Src/Newtonsoft.Json.Tests/Serialization/ConstructorHandlingTests.cs
  55. +20 −0 Src/Newtonsoft.Json.Tests/Serialization/ContractResolverTests.cs
  56. +7 −0 Src/Newtonsoft.Json.Tests/Serialization/DefaultValueHandlingTests.cs
  57. +18 −14 Src/Newtonsoft.Json.Tests/Serialization/DynamicTests.cs
  58. +8 −1 Src/Newtonsoft.Json.Tests/Serialization/EntitiesSerializationTests.cs
  59. +7 −0 Src/Newtonsoft.Json.Tests/Serialization/JsonPropertyCollectionTests.cs
  60. +259 −127 Src/Newtonsoft.Json.Tests/Serialization/JsonSerializerTest.cs
  61. +17 −2 Src/Newtonsoft.Json.Tests/Serialization/MissingMemberHandlingTests.cs
  62. +7 −0 Src/Newtonsoft.Json.Tests/Serialization/NullValueHandlingTests.cs
  63. +12 −2 Src/Newtonsoft.Json.Tests/Serialization/PopulateTests.cs
  64. +17 −3 Src/Newtonsoft.Json.Tests/Serialization/PreserveReferencesHandlingTests.cs
  65. +7 −0 Src/Newtonsoft.Json.Tests/Serialization/SerializationErrorHandlingTests.cs
  66. +9 −1 Src/Newtonsoft.Json.Tests/Serialization/SerializationEventAttributeTests.cs
  67. +34 −22 Src/Newtonsoft.Json.Tests/Serialization/TypeNameHandlingTests.cs
  68. +6 −0 Src/Newtonsoft.Json.Tests/SilverlightTests.cs
  69. +67 −5 Src/Newtonsoft.Json.Tests/TestFixtureBase.cs
  70. +2 −0 Src/Newtonsoft.Json.Tests/TestObjects/ConverableMembers.cs
  71. +1 −1 Src/Newtonsoft.Json.Tests/TestObjects/DefaultValueAttributeTestClass.cs
  72. +1 −0 Src/Newtonsoft.Json.Tests/TestObjects/ListOfIds.cs
  73. +1 −1 Src/Newtonsoft.Json.Tests/TestObjects/Person.cs
  74. +0 −1 Src/Newtonsoft.Json.Tests/TestObjects/SerializationEventTestList.cs
  75. +1 −1 Src/Newtonsoft.Json.Tests/TestObjects/TypedSubHashtable.cs
  76. +41 −22 Src/Newtonsoft.Json.Tests/Utilities/DynamicReflectionDelegateFactoryTests.cs
  77. +7 −0 Src/Newtonsoft.Json.Tests/Utilities/ReflectionUtilsTests.cs
  78. +4 −0 Src/Newtonsoft.Json/Bson/BsonBinaryWriter.cs
  79. +4 −0 Src/Newtonsoft.Json/Bson/BsonReader.cs
  80. +7 −1 Src/Newtonsoft.Json/Bson/BsonWriter.cs
  81. +5 −5 Src/Newtonsoft.Json/Converters/BinaryConverter.cs
  82. +1 −0 Src/Newtonsoft.Json/Converters/CustomCreationConverter.cs
  83. +1 −1 Src/Newtonsoft.Json/Converters/DataSetConverter.cs
  84. +1 −1 Src/Newtonsoft.Json/Converters/DataTableConverter.cs
  85. +1 −1 Src/Newtonsoft.Json/Converters/EntityKeyMemberConverter.cs
  86. +1 −1 Src/Newtonsoft.Json/Converters/KeyValuePairConverter.cs
  87. +1 −1 Src/Newtonsoft.Json/Converters/StringEnumConverter.cs
  88. +9 −5 Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs
  89. +1 −1 Src/Newtonsoft.Json/FormatterAssemblyStyle.cs
  90. +15 −4 Src/Newtonsoft.Json/JsonConvert.cs
  91. +2 −2 Src/Newtonsoft.Json/JsonReader.cs
  92. +2 −2 Src/Newtonsoft.Json/JsonReaderException.cs
  93. +2 −2 Src/Newtonsoft.Json/JsonSerializationException.cs
  94. +4 −0 Src/Newtonsoft.Json/JsonTextReader.cs
  95. +4 −0 Src/Newtonsoft.Json/JsonTextWriter.cs
  96. +5 −2 Src/Newtonsoft.Json/JsonWriter.cs
  97. +2 −2 Src/Newtonsoft.Json/JsonWriterException.cs
  98. +10 −10 Src/Newtonsoft.Json/Linq/JContainer.cs
  99. +8 −8 Src/Newtonsoft.Json/Linq/JObject.cs
  100. +1 −1 Src/Newtonsoft.Json/Linq/JPropertyDescriptor.cs
  101. +2 −2 Src/Newtonsoft.Json/Linq/JToken.cs
  102. +7 −1 Src/Newtonsoft.Json/Linq/JTokenWriter.cs
  103. +2 −0 Src/Newtonsoft.Json/Linq/JValue.cs
  104. +282 −0 Src/Newtonsoft.Json/Newtonsoft.Json.Metro.csproj
  105. +1 −0 Src/Newtonsoft.Json/Newtonsoft.Json.Net20.csproj
  106. +1 −0 Src/Newtonsoft.Json/Newtonsoft.Json.Net35.csproj
  107. +1 −0 Src/Newtonsoft.Json/Newtonsoft.Json.Silverlight.csproj
  108. +1 −0 Src/Newtonsoft.Json/Newtonsoft.Json.WindowsPhone.csproj
  109. +1 −0 Src/Newtonsoft.Json/Newtonsoft.Json.csproj
  110. +1 −1 Src/Newtonsoft.Json/Properties/AssemblyInfo.cs
  111. +2 −2 Src/Newtonsoft.Json/Schema/JsonSchemaException.cs
  112. +11 −7 Src/Newtonsoft.Json/Schema/JsonSchemaGenerator.cs
  113. +3 −0 Src/Newtonsoft.Json/Serialization/CachedAttributeGetter.cs
  114. +47 −22 Src/Newtonsoft.Json/Serialization/DefaultContractResolver.cs
  115. +7 −2 Src/Newtonsoft.Json/Serialization/DefaultSerializationBinder.cs
  116. +2 −2 Src/Newtonsoft.Json/Serialization/JsonArrayContract.cs
  117. +5 −2 Src/Newtonsoft.Json/Serialization/JsonContract.cs
  118. +5 −1 Src/Newtonsoft.Json/Serialization/JsonDictionaryContract.cs
  119. +1 −1 Src/Newtonsoft.Json/Serialization/JsonFormatterConverter.cs
  120. +1 −1 Src/Newtonsoft.Json/Serialization/JsonISerializableContract.cs
  121. +1 −1 Src/Newtonsoft.Json/Serialization/JsonSerializerInternalBase.cs
  122. +10 −8 Src/Newtonsoft.Json/Serialization/JsonSerializerInternalReader.cs
  123. +12 −8 Src/Newtonsoft.Json/Serialization/JsonSerializerInternalWriter.cs
  124. +52 −28 Src/Newtonsoft.Json/Serialization/JsonTypeReflector.cs
  125. +1 −1 Src/Newtonsoft.Json/Serialization/LateBoundMetadataTypeAttribute.cs
  126. +1 −1 Src/Newtonsoft.Json/SerializationBinder.cs
  127. +4 −0 Src/Newtonsoft.Json/Utilities/CollectionUtils.cs
  128. +1 −1 Src/Newtonsoft.Json/Utilities/CollectionWrapper.cs
  129. +192 −10 Src/Newtonsoft.Json/Utilities/ConvertUtils.cs
  130. +2 −0 Src/Newtonsoft.Json/Utilities/DateTimeUtils.cs
  131. +187 −97 Src/Newtonsoft.Json/Utilities/DictionaryWrapper.cs
  132. +8 −4 Src/Newtonsoft.Json/Utilities/DynamicProxyMetaObject.cs
  133. +6 −6 Src/Newtonsoft.Json/Utilities/DynamicReflectionDelegateFactory.cs
  134. +2 −54 Src/Newtonsoft.Json/Utilities/DynamicWrapper.cs
  135. +2 −2 Src/Newtonsoft.Json/Utilities/EnumUtils.cs
  136. +3 −3 Src/Newtonsoft.Json/Utilities/ILGeneratorExtensions.cs
  137. +1 −1 Src/Newtonsoft.Json/Utilities/LateBoundReflectionDelegateFactory.cs
  138. +152 −64 Src/Newtonsoft.Json/Utilities/ReflectionUtils.cs
  139. +7 −1 Src/Newtonsoft.Json/Utilities/StringUtils.cs
  140. +537 −0 Src/Newtonsoft.Json/Utilities/TypeExtensions.cs
  141. +1 −1 Src/Newtonsoft.Json/Utilities/ValidationUtils.cs
View
@@ -0,0 +1,5 @@
+[Bb]in/
+[Oo]bj/
+[Ww]orking/
+*.suo
+*.user
@@ -0,0 +1,64 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 11
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Newtonsoft.Json.Metro", "Newtonsoft.Json\Newtonsoft.Json.Metro.csproj", "{263136A2-B89B-424E-A87A-F988CAA8D032}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Newtonsoft.Json.Tests.Metro", "Newtonsoft.Json.Tests\Newtonsoft.Json.Tests.Metro.csproj", "{8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|ARM = Debug|ARM
+ Debug|Any CPU = Debug|Any CPU
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Release|ARM = Release|ARM
+ Release|Any CPU = Release|Any CPU
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {263136A2-B89B-424E-A87A-F988CAA8D032}.Debug|ARM.ActiveCfg = Debug|ARM
+ {263136A2-B89B-424E-A87A-F988CAA8D032}.Debug|ARM.Build.0 = Debug|ARM
+ {263136A2-B89B-424E-A87A-F988CAA8D032}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {263136A2-B89B-424E-A87A-F988CAA8D032}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {263136A2-B89B-424E-A87A-F988CAA8D032}.Debug|x64.ActiveCfg = Debug|x64
+ {263136A2-B89B-424E-A87A-F988CAA8D032}.Debug|x64.Build.0 = Debug|x64
+ {263136A2-B89B-424E-A87A-F988CAA8D032}.Debug|x86.ActiveCfg = Debug|x86
+ {263136A2-B89B-424E-A87A-F988CAA8D032}.Debug|x86.Build.0 = Debug|x86
+ {263136A2-B89B-424E-A87A-F988CAA8D032}.Release|ARM.ActiveCfg = Release|ARM
+ {263136A2-B89B-424E-A87A-F988CAA8D032}.Release|ARM.Build.0 = Release|ARM
+ {263136A2-B89B-424E-A87A-F988CAA8D032}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {263136A2-B89B-424E-A87A-F988CAA8D032}.Release|Any CPU.Build.0 = Release|Any CPU
+ {263136A2-B89B-424E-A87A-F988CAA8D032}.Release|x64.ActiveCfg = Release|x64
+ {263136A2-B89B-424E-A87A-F988CAA8D032}.Release|x64.Build.0 = Release|x64
+ {263136A2-B89B-424E-A87A-F988CAA8D032}.Release|x86.ActiveCfg = Release|x86
+ {263136A2-B89B-424E-A87A-F988CAA8D032}.Release|x86.Build.0 = Release|x86
+ {8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Debug|ARM.ActiveCfg = Debug|ARM
+ {8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Debug|ARM.Build.0 = Debug|ARM
+ {8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Debug|ARM.Deploy.0 = Debug|ARM
+ {8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
+ {8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Debug|x64.ActiveCfg = Debug|x64
+ {8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Debug|x64.Build.0 = Debug|x64
+ {8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Debug|x64.Deploy.0 = Debug|x64
+ {8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Debug|x86.ActiveCfg = Debug|x86
+ {8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Debug|x86.Build.0 = Debug|x86
+ {8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Debug|x86.Deploy.0 = Debug|x86
+ {8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Release|ARM.ActiveCfg = Release|ARM
+ {8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Release|ARM.Build.0 = Release|ARM
+ {8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Release|ARM.Deploy.0 = Release|ARM
+ {8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Release|Any CPU.Build.0 = Release|Any CPU
+ {8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Release|Any CPU.Deploy.0 = Release|Any CPU
+ {8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Release|x64.ActiveCfg = Release|x64
+ {8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Release|x64.Build.0 = Release|x64
+ {8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Release|x64.Deploy.0 = Release|x64
+ {8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Release|x86.ActiveCfg = Release|x86
+ {8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Release|x86.Build.0 = Release|x86
+ {8D9C2E69-9FD7-4A7A-866C-739C9207CD0B}.Release|x86.Deploy.0 = Release|x86
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
@@ -28,7 +28,13 @@
using System.Globalization;
using System.Linq;
using System.Text;
+#if !NETFX_CORE
using NUnit.Framework;
+#else
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using TestFixture = Microsoft.VisualStudio.TestTools.UnitTesting.TestClassAttribute;
+using Test = Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute;
+#endif
using Newtonsoft.Json.Bson;
using System.IO;
using Newtonsoft.Json.Tests.Serialization;
@@ -37,6 +43,7 @@
namespace Newtonsoft.Json.Tests.Bson
{
+ [TestFixture]
public class BsonReaderTests : TestFixtureBase
{
private const char Euro = '\u20ac';
@@ -76,7 +83,7 @@ public void ReadSingleObject()
Assert.IsTrue(reader.Read());
Assert.AreEqual(JsonToken.Integer, reader.TokenType);
- Assert.AreEqual(1, reader.Value);
+ Assert.AreEqual(1L, reader.Value);
Assert.AreEqual(typeof(long), reader.ValueType);
Assert.IsTrue(reader.Read());
@@ -111,22 +118,22 @@ public void WriteValues()
Assert.IsTrue(reader.Read());
Assert.AreEqual(JsonToken.Integer, reader.TokenType);
- Assert.AreEqual(int.MaxValue, reader.Value);
+ Assert.AreEqual((long)int.MaxValue, reader.Value);
Assert.AreEqual(typeof(long), reader.ValueType);
Assert.IsTrue(reader.Read());
Assert.AreEqual(JsonToken.Integer, reader.TokenType);
- Assert.AreEqual(int.MaxValue, reader.Value);
+ Assert.AreEqual((long)int.MaxValue, reader.Value);
Assert.AreEqual(typeof(long), reader.ValueType);
Assert.IsTrue(reader.Read());
Assert.AreEqual(JsonToken.Integer, reader.TokenType);
- Assert.AreEqual(byte.MaxValue, reader.Value);
+ Assert.AreEqual((long)byte.MaxValue, reader.Value);
Assert.AreEqual(typeof(long), reader.ValueType);
Assert.IsTrue(reader.Read());
Assert.AreEqual(JsonToken.Integer, reader.TokenType);
- Assert.AreEqual(sbyte.MaxValue, reader.Value);
+ Assert.AreEqual((long)sbyte.MaxValue, reader.Value);
Assert.AreEqual(typeof(long), reader.ValueType);
Assert.IsTrue(reader.Read());
@@ -136,17 +143,17 @@ public void WriteValues()
Assert.IsTrue(reader.Read());
Assert.AreEqual(JsonToken.Float, reader.TokenType);
- Assert.AreEqual(decimal.MaxValue, reader.Value);
+ Assert.AreEqual((double)decimal.MaxValue, reader.Value);
Assert.AreEqual(typeof(double), reader.ValueType);
Assert.IsTrue(reader.Read());
Assert.AreEqual(JsonToken.Float, reader.TokenType);
- Assert.AreEqual(double.MaxValue, reader.Value);
+ Assert.AreEqual((double)double.MaxValue, reader.Value);
Assert.AreEqual(typeof(double), reader.ValueType);
Assert.IsTrue(reader.Read());
Assert.AreEqual(JsonToken.Float, reader.TokenType);
- Assert.AreEqual(float.MaxValue, reader.Value);
+ Assert.AreEqual((double)float.MaxValue, reader.Value);
Assert.AreEqual(typeof(double), reader.ValueType);
Assert.IsTrue(reader.Read());
@@ -156,7 +163,7 @@ public void WriteValues()
Assert.IsTrue(reader.Read());
Assert.AreEqual(JsonToken.Bytes, reader.TokenType);
- Assert.AreEqual(new byte[] { 0, 1, 2, 3, 4 }, reader.Value);
+ CollectionAssert.AreEquivalent(new byte[] { 0, 1, 2, 3, 4 }, (byte[])reader.Value);
Assert.AreEqual(typeof(byte[]), reader.ValueType);
Assert.IsTrue(reader.Read());
@@ -268,27 +275,30 @@ public void ReadArrayBsonFromSite()
}
[Test]
- [ExpectedException(typeof(JsonReaderException), ExpectedMessage = "Could not convert string to integer: a.")]
public void ReadAsInt32BadString()
{
- byte[] data = MiscellaneousUtils.HexToBytes("20-00-00-00-02-30-00-02-00-00-00-61-00-02-31-00-02-00-00-00-62-00-02-32-00-02-00-00-00-63-00-00");
+ ExceptionAssert.Throws<JsonReaderException>("Could not convert string to integer: a.",
+ () =>
+ {
+ byte[] data = MiscellaneousUtils.HexToBytes("20-00-00-00-02-30-00-02-00-00-00-61-00-02-31-00-02-00-00-00-62-00-02-32-00-02-00-00-00-63-00-00");
- MemoryStream ms = new MemoryStream(data);
- BsonReader reader = new BsonReader(ms);
+ MemoryStream ms = new MemoryStream(data);
+ BsonReader reader = new BsonReader(ms);
- Assert.AreEqual(false, reader.ReadRootValueAsArray);
- Assert.AreEqual(DateTimeKind.Local, reader.DateTimeKindHandling);
+ Assert.AreEqual(false, reader.ReadRootValueAsArray);
+ Assert.AreEqual(DateTimeKind.Local, reader.DateTimeKindHandling);
- reader.ReadRootValueAsArray = true;
- reader.DateTimeKindHandling = DateTimeKind.Utc;
+ reader.ReadRootValueAsArray = true;
+ reader.DateTimeKindHandling = DateTimeKind.Utc;
- Assert.AreEqual(true, reader.ReadRootValueAsArray);
- Assert.AreEqual(DateTimeKind.Utc, reader.DateTimeKindHandling);
+ Assert.AreEqual(true, reader.ReadRootValueAsArray);
+ Assert.AreEqual(DateTimeKind.Utc, reader.DateTimeKindHandling);
- Assert.IsTrue(reader.Read());
- Assert.AreEqual(JsonToken.StartArray, reader.TokenType);
+ Assert.IsTrue(reader.Read());
+ Assert.AreEqual(JsonToken.StartArray, reader.TokenType);
- reader.ReadAsInt32();
+ reader.ReadAsInt32();
+ });
}
[Test]
@@ -349,7 +359,7 @@ public void ReadOid()
Assert.IsTrue(reader.Read());
Assert.AreEqual(JsonToken.Bytes, reader.TokenType);
- Assert.AreEqual(MiscellaneousUtils.HexToBytes("4ABBED9D1D8B0F0218000001"), reader.Value);
+ CollectionAssert.AreEquivalent(MiscellaneousUtils.HexToBytes("4ABBED9D1D8B0F0218000001"), (byte[])reader.Value);
Assert.AreEqual(typeof(byte[]), reader.ValueType);
Assert.IsTrue(reader.Read());
@@ -387,7 +397,7 @@ public void ReadNestedArray()
Assert.IsTrue(reader.Read());
Assert.AreEqual(JsonToken.Bytes, reader.TokenType);
- Assert.AreEqual(MiscellaneousUtils.HexToBytes("4A-78-93-79-17-22-00-00-00-00-61-CF"), reader.Value);
+ CollectionAssert.AreEquivalent(MiscellaneousUtils.HexToBytes("4A-78-93-79-17-22-00-00-00-00-61-CF"), (byte[])reader.Value);
Assert.AreEqual(typeof(byte[]), reader.ValueType);
Assert.IsTrue(reader.Read());
@@ -623,7 +633,7 @@ public void ReadReference()
Assert.IsTrue(reader.Read());
Assert.AreEqual(JsonToken.Bytes, reader.TokenType);
- Assert.AreEqual(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }, reader.Value);
+ CollectionAssert.AreEquivalent(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }, (byte[])reader.Value);
Assert.AreEqual(typeof(byte[]), reader.ValueType);
Assert.IsTrue(reader.Read());
@@ -1282,11 +1292,11 @@ public void DeserializeByteArrayWithTypeNameHandling()
TestObject newObject = (TestObject)serializer.Deserialize(bsonReader);
Assert.AreEqual("Test", newObject.Name);
- Assert.AreEqual(new byte[] { 72, 63, 62, 71, 92, 55 }, newObject.Data);
+ CollectionAssert.AreEquivalent(new byte[] { 72, 63, 62, 71, 92, 55 }, newObject.Data);
}
}
-#if !(WINDOWS_PHONE || SILVERLIGHT || NET20 || NET35)
+#if !(WINDOWS_PHONE || SILVERLIGHT || NET20 || NET35 || NETFX_CORE)
public void Utf8Text()
{
string badText =System.IO.File.ReadAllText(@"PoisonText.txt");
Oops, something went wrong.

0 comments on commit 5800e97

Please sign in to comment.