0

When running NUnit unit tests within Resharper, I'm getting the following error:

SetUp method failed. SetUp : System.IO.FileNotFoundException : Could not 
load file or assembly 'Microsoft.Practices.Unity, Version=2.0.414.0, 
Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. 
The system cannot find the file specified.

If I then "Re-run the failed unit test" they complete (albeit this may take many times of re-runs). Appears to be since I upgraded to Resharper v8 from v7.

Running any of the multiple applications that we are unit testing does not show this error. We are using the ServiceLocator pattern throughout our code.

Rebecca
  • 13,914
  • 10
  • 95
  • 136

2 Answers2

1

I appear to have fixed this within the Resharper settings, forcing each assembly to have its own AppDomain whilst running tests. See the third checkbox option down under Resharper -> Options -> Tools -> Unit Testing.

Screenshot of Resharper Unit Test option for separate AppDomains

Rebecca
  • 13,914
  • 10
  • 95
  • 136
  • I had a similar issue to this and the solution above seems to have remedied it. Funny thing is that when i run tests from the solution context menu, it would work fine. But re-running from within the unit test dialog failed. Either way, nice find. Also found (and bumped up) unit testing parallelisation just because. – Daniel Park Nov 12 '14 at 04:32
0

You should check that you used the first version of unity in the main project, because must match to test project and your main project in the meantime you must check all unity dll's.

Oğuzhan Soykan
  • 2,522
  • 2
  • 18
  • 33
  • 1
    what do you mean by "main project"? We have multiple projects that are being unit tested. Where appropriate we are redirecting unity versions in the app or web.config. – Rebecca Aug 06 '14 at 09:44