Changed all projects to output .NET 4 assemblies.

NuGet packages are not yet changed to target .NET 4.
Addressed compiler warnings.
Addressed some Code Analysis warnings.
Replaced NSubstitute.dll with .NET 4 version,

because the previous version was for .NET 3.5, and gave compiler warnings.
Refactored a unit test to report a detailed error,

since I've seen this test fail, but can't reproduce it for the time being.
Changed all nuspecs to target .NET 4.0.