Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Microsoft Unit Testing failure, unable to load DLL to test

I've got a .NET 3.5 class lib that I am trying to write some automated tests for but I'm getting the following error when running any tests in the solution:

Test method Common.Tests.CommonTests.TestMethod1 threw exception: System.IO.FileNotFoundException: Could not load file or assembly 'Library.Common, Version=0.0.1.22004, Culture=en-AU, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.WRN: Assembly binding logging is turned OFF.

To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.

Note: There is some performance penalty associated with assembly bind failure logging.

To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

I'm fairly new to unit testing so I'm stumped.

I've compaired the references between the lib and the tests project and the only difference is that the tests project references the MS unit test DLL.

Edit to clarify

I used the test creation wizard from within my 'Library.Common' project so the test project has the reference to the Library.Common project. I've cleaned and built the solution too, that's not the problem.

Library.Common.dll is also in the bin\Debug folder of my test project output.

like image 534
Aaron Powell Avatar asked Oct 14 '08 01:10

Aaron Powell


People also ask

How do I run a test file in C#?

Either go to Solution Explorer (Ctrl +Alt+L) and right click on Solution 'BasicMath' and click on Build Solution or go to Build Menu (Alt + B) and Click on Build Solution. Choose Test Menu -> Run -> All Test or instead of this step, you can follow the given step also.

Do unit tests run in parallel C#?

Unit tests run one at a time. There is no parallelism.


1 Answers

Found the problem, I had set the AssemblyCultureAttribute in the AssemblyInfo.cs file in my Library.Common project. Once removing it the tests run.

Now to actually learn how to use that attribute!

like image 143
Aaron Powell Avatar answered Nov 14 '22 22:11

Aaron Powell