-Fixed WinRT build

This commit is contained in:
James Newton-King
2014-09-12 20:55:20 +12:00
parent 6bb1b77fa4
commit 4b9ce67ab7
4 changed files with 17 additions and 4 deletions
@@ -55,6 +55,7 @@ namespace Newtonsoft.Json.Tests.Bson
{ {
private const char Euro = '\u20ac'; private const char Euro = '\u20ac';
#if !NETFX_CORE
[Test] [Test]
public void DeserializeLargeBsonObject() public void DeserializeLargeBsonObject()
{ {
@@ -67,6 +68,7 @@ namespace Newtonsoft.Json.Tests.Bson
Assert.AreEqual("1", (string)o["$id"]); Assert.AreEqual("1", (string)o["$id"]);
} }
#endif
[Test] [Test]
public void CloseInput() public void CloseInput()
@@ -371,6 +371,9 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="Newtonsoft.Json.Tests.WinRT_TemporaryKey.pfx" /> <None Include="Newtonsoft.Json.Tests.WinRT_TemporaryKey.pfx" />
<Content Include="SpaceShipV2.bson">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System.Collections.Immutable"> <Reference Include="System.Collections.Immutable">
@@ -7473,7 +7473,9 @@ To fix this error either change the environment to be fully trusted, change the
} }
#endif #endif
#if !NETFX_CORE
[Serializable] [Serializable]
#endif
[DataContract] [DataContract]
public struct Pair<TFirst, TSecond> public struct Pair<TFirst, TSecond>
{ {
+10 -4
View File
@@ -164,18 +164,23 @@ namespace Newtonsoft.Json.Tests
public static void Contains(IList collection, object value) public static void Contains(IList collection, object value)
{ {
Contains(collection, value, null);
}
public static void Contains(IList collection, object value, string message)
{
#if !NETFX_CORE #if !NETFX_CORE
Assert.Contains(value, collection); Assert.Contains(value, collection, message);
#else #else
if (!collection.Cast<object>().Any(i => i.Equals(value))) if (!collection.Cast<object>().Any(i => i.Equals(value)))
throw new Exception("Value not found in collection."); throw new Exception(message ?? "Value not found in collection.");
#endif #endif
} }
} }
public static class StringAssert public static class StringAssert
{ {
private readonly static Regex Regex = new Regex(@"\r\n|\n\r|\n|\r", RegexOptions.CultureInvariant | RegexOptions.Compiled); private readonly static Regex Regex = new Regex(@"\r\n|\n\r|\n|\r", RegexOptions.CultureInvariant);
public static void AreEqual(string expected, string actual) public static void AreEqual(string expected, string actual)
{ {
@@ -222,7 +227,8 @@ namespace Newtonsoft.Json.Tests
} }
catch (TException ex) catch (TException ex)
{ {
Assert.Contains (ex.Message, possibleMessages, "Unexpected exception message." + Environment.NewLine + "Expected One of: " + string.Join (Environment.NewLine, possibleMessages) + Environment.NewLine + "Got: " + ex.Message + Environment.NewLine + Environment.NewLine + ex); if (possibleMessages != null && possibleMessages.Length > 0)
CustomAssert.Contains(possibleMessages, ex.Message, "Unexpected exception message." + Environment.NewLine + "Expected one of: " + string.Join(Environment.NewLine, possibleMessages) + Environment.NewLine + "Got: " + ex.Message + Environment.NewLine + Environment.NewLine + ex);
} }
catch (Exception ex) catch (Exception ex)
{ {