Rebecca
Rebecca

Reputation: 14402

Resharper NUnit tests failing with Unity

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.

Upvotes: 0

Views: 686

Answers (2)

Rebecca
Rebecca

Reputation: 14402

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

Upvotes: 1

Oğuzhan Soykan
Oğuzhan Soykan

Reputation: 2690

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.

Upvotes: 0

Related Questions