Created attachment 1178482 [details] adding reference to NUnit first to say: I don't know if it is necessary to build the tests. Related to comment in spec file: FIXME tests need xunit (not packaged yet) I just tried that it works with nunit (see attached patch), and xunit is not really needed as far as I can see. There are still other errors though... DemoTests.cs(28,14): error CS0234: The type or namespace name `Buffers' does not exist in the namespace `System'. Are you missing an assembly reference? Utilities/DateTimeUtilsTests.cs(56,24): error CS0122: `Newtonsoft.Json.Utilities.StringReference' is inaccessible due to its protection level
Do we need nunit (currently version 3.4) or the nunit2 compatibility package?
I found one solution, to build not the Newtonsoft.Json.Tests.csproj but Newtonsoft.Json.Tests.Net40.csproj instead. This resolves already a number of issues. But then there is still that error "is inaccessible due to its protection level". I can replace all internal with public, but that is quite strange. I wonder if that ever can compile on .Net 4.x. By definition, if a struct or class is internal, it can only be accessed within the assembly (https://msdn.microsoft.com/library/7c5ka91b.aspx). I will ask upstream.
http://stackoverflow.com/questions/39281352/cannot-build-newtonsoft-json-tests-with-mono-4-due-to-inaccessible-internal-stru
ok, the NewtonSoft.Json.Tests.dll now compiles, and I get the result of the tests: Tests run: 2314, Errors: 10, Failures: 7, Inconclusive: 0, Time: 12.1892758 seconds Not run: 1, Invalid: 0, Ignored: 1, Skipped: 0 I therefore have not enabled the tests yet, but committed the fixes for the tests dll to build.
Created attachment 1197053 [details] log of the failing unit tests
Thanks Raphael for the link on IRC to http://pkgs.fedoraproject.org/cgit/rpms/sharpziplib.git/tree/sharpziplib.spec#n89 I have now disabled the 17 tests that failed or had an error. I also switched from NUnit2 to NUnit3.
actually, when I run the tests with nunit3-console, I get: 1) Invalid : /root/rpmbuild/BUILD/Newtonsoft.Json-9.0.1/Src/Newtonsoft.Json.Tests/bin/Release/Net40/Newtonsoft.Json.Tests.dll No suitable tests found in '/root/rpmbuild/BUILD/Newtonsoft.Json-9.0.1/Src/Newtonsoft.Json.Tests/bin/Release/Net40/Newtonsoft.Json.Tests.dll'. Either assembly contains no tests or proper test driver has not been found. I need to look at this another day. I wonder if this is a packaging bug in the nunit package.
Maybe some API thingy. IMHO, we should keep going with nunit2 for now.