I've just started trying to get this working for Silverlight 4 and
here are a few things that I encountered.
1)
https://github.com/nsubstitute/NSubstitute/blob/master/Source/NSubstitute/Core/CallStack.cs
line 59 does not compile.The line in question is:
public T[] ToArray() { LockedAction(() => _stack.ToArray()); }
I think the implementation below should match the intent and seems to
work for me
public T[] ToArray()
{
T[] array = default(T[]);
LockedAction(() => array = _stack.ToArray());
return array;
}
2) NSubstitute\Source\NSubstitute.Acceptance.Specs
\NSubstitute.Acceptance.Specs.csproj line 249 and \NSubstitute\Source
\NSubstitute.Specs\NSubstitute.Specs.csproj line 303 were:
<SilverlightLibraryPath>$(ProgramFiles32)\Microsoft Silverlight
\4.0.60831.0</SilverlightLibraryPath>
I had a different build number (4.0.60531.0 as I had not applied a
security patch yet) but perhaps changing it to the line below would
make the build more tolerant. These are the same files that are being
referenced by the projects as assemblies in any case when it is built
as SL40.
<SilverlightLibraryPath>$(ProgramFiles32)\Reference Assemblies
\Microsoft\Framework\Silverlight\v4.0</SilverlightLibraryPath>
3) After those changes I was able to get the solution to build in
Visual Studio 2010. The build instruction on the wiki page (rake
target="SL40") doesn’t actually trigger the build at the moment
because
https://github.com/nsubstitute/NSubstitute/blob/master/Build/rakefile
line 13 does not include the “SL40” target. After including the target
again, the build runs successfully with 213 tests passing, 4 Ignored
(as per the wiki page) and none fail. Looking at the tests within the
solution it seems like the build is not running a significant number
of the tests but I haven't got round to investigating any of these
yet.