Enterprise Library 4.1 - unit test don't work

Note: Run the "Install Instrumentation" menu option from the Microsoft Patterns and Practices menu or the Unit Test will fail during [TestInitialize] method. 

When first attempting to run Unit Test for Enterprise Library 4.1, I was greeted with the following message (other times it would just hang - VS would go Not Responding): 

Although I have an x64, Intel Core 2 Duo CPU T5750 @ 2.00Ghz system with 4 Gig RAM I also recognized a large number of Unit Test in the solution so I unloaded the following projects

Keeping only the projects I'm currently interested in loaded (reflected by curved arrow above).

Now my Unit Test would actually run but I was greeted with an odd (unexpected) error:

What was odd about this error message was that the current assembly shows "Logging" and the error message complains that it can't load "Logging"; odd that it was complaining that it couldn't load itself.

The key to this error was the PublickeyToken - the current running assembly (project) shows a PublicKeyToken=null where the error has an actual token.  Something was attempting to load a different assembly of the same name but from a .DLL (not project).  

The next step was to locate the offending process - in this case it was the reader that was complaining so as I examined it's value I noted the "RollingFlatFileTraceListenerData".   Running a global search for this class (more specifically - within a .Config file) resulted in the following:

The configuration file was requesting a specific .DLL where our Unit Test has a reference to the actual project - two different .DLLs.

The fix was to remove everything after the Assembly name as shown below - this will allow it to default to the project being used by the Unit Test.

Be sure to rebuild your solution before attempting to run the Unit Test after updating the .Config file.

After complying with the above steps I was able to run the above referenced Unit Test and it passed. 

VALIDATION SOLUTION

Do a solution search and replace for the for the following (without the quotes):
", Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"

After the above search and replace you'll find that we're down to 37 failures; many associated with the Performance Counter.

 To be continued...

OTHER CONSIDERATIONS - Proper Setup

Note: I use Visual Studio 2008 Professional Edition


Tags: , ,
Categories:


Actions: E-mail | Permalink |  Grammar/Typo/Better way? Please let me know