JamesNK/Newtonsoft.Json — pull request #371 by Redth (2014-09-09 14:03:07+00:00)
Title: Portable Tests working on Mono / OSX

Currently this is meant to be a work in progress, but I wanted to start some dialog around it.

The goal of this PR is to get the Newtonsoft.Json.Portable.Tests.csproj tests as green as possible on Mono 3.8, on OSX. This will serve the further purpose of making sure the Portable library works well on Xamarin.iOS and Xamarin.Android.

Many of the tests were red because of the way that line breaks were included inside of `@"verbatim"` strings used in `Assert.*` methods within the test code itself. In these cases, I've changed the strings used in asserts to explicitly declare `\r\n`in them for line breaks instead of letting the IDE decide at compile time (which on OSX / Mono was actually `\n` causing the asserts to fail even though the tests should pass).

Another common pattern that was failing on Mono/OSX was testing the `Exception.Message` properties for a specific type of exception. On Mono, sometimes the exception messages are not identical to Microsoft's runtime exception messages, causing the asserts to fail when the test should actually be passing.

There are still 23 tests failing, some of which are relating to Culture differences in mono vs microsoft runtimes. Those will be investigated next and may require patches to mono, or loosening the asserts in the tests.