0

I am using EnterpriseLibrary.ExceptionHandling Version 5 for error handling. Working perfect in project. But when run all unittest in project getting error:

Strong name verification failed for the instrumented assembly 'Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Please ensure that the right key file for re-signing after instrumentation is specified in the test settings.

Although if I run the particular test only in debug mode working fine as expected.

Please suggest. Thanks

LU RD
  • 34,438
  • 5
  • 88
  • 296
Arvind
  • 61
  • 1
  • 3
  • 9

1 Answers1

0

I got the answer it was becuase of Code Coverage is checked in Test --> Local Settings. So i created a interface to mock the exception class like

using Microsoft.Practices.EnterpriseLibrary.ExceptionHandling;
public interface IExceptionHandler
{
    bool HandleException(System.Exception oex, string policy);
}


[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
public class ExceptionHandler : IExceptionHandler
{
    public bool HandleException(System.Exception oex, string policy)
    {
        return ExceptionPolicy.HandleException(oex, policy);
    }
}
Arvind
  • 61
  • 1
  • 3
  • 9