Everyday problems and solutions living the life of an adventurous developer at the intersection of .NET and IOS.

07 December, 2008

NMock Not Executed (not trusted location)

I have begun reading the book “Microsoft .NET: Architecting Applications for the Enterprise” by Dino Esposito. One of his many chapters touches on the matter of Unit testing and usage of Mocks for factoring out dependencies of classes.

So I downloaded NMock2 from sourceforge and extracted it to disk. The very first thing I was presented with when running a newly created Unittest where I used the NMock framework was the below (Test not Executed):

If you press the hyperlink “Test run error” you see this message: “The location of the file or directory xxx is not trusted”

What to do?Well – it is quite simple to mitigate this situation (to make the NMock assembly a trusted companion). Just find the NMock assembly on disk and “unblock” it! You are good to go. It does however require a restart of Visual Studio to make the latter comprehend that you consider the NMock assembly a trusted companion.