I have a suite of NUnit tests in a project with AnyCPU architecture. Some of these tests use types from an x86 (32-bit) assembly.
When I run the tests locally (via ReSha
nunit3-console MyProject.csproj
runs the tests in 64-bit process by default, which make it impossible to load 32-bit assemblies. This doesn't have anything to do with build server, so the same would happen on TeamCity etc.
nunit3-console MyProject.csproj --x86
.Analogous problem with xUnit can be solved by running dotnet xunit -x86
.
I think that for dotnet test
the command dotnet test --runtime win10-x86
(with proper system flag) would help.
ReSharper test runner by default automatically chooses the "bittedness" of the process. Maybe it analyses assembly references in test files, I don't know. Anyway, in my case it was choosing 32-bit runner for my unit tests. When I forced it to use 64-bit (Unit Test Sessions —> Options —> Platform —> x64), a few tests failed with same message as on Jenkins.