Running unit test on a TeamCity is usually not a big problem but a couple of days ago I noticed I very strange behaviour.
The number of tests executed on the build server was much smaller than the number of tests running on my local machine but TeamCity did not report any errors. After digging into the build log, I noticed this exception in the log files:
System.Runtime.Serialization.SerializationException: Unable to find assembly 'FakeItEasy, Version=184.108.40.206, Culture=neutral, PublicKeyToken=eff28e2146d5fd2c'.
The only noticeable difference between the execution on TeamCity and my local machine was that locally I used the ReSharper test runner and on the build server xunit.console.exe was used to run the test.
When trying to run the tests with xunit.console.exe on my local machine I could reproduce the error.
For some unclear reason, XUnit was not able to load the FakeItEasy assembly that was located in the bin folder of the test assembly. The only workaround I found was to copy the FakeItEasy assembly to the folder of xunit.console.exe. After doing this, the number of tests on my local machine and on TeamCity matched again.
This is not really a satisfying solution, but I couldn’t find a better solution. Did someone find a proper solution for this problem?