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

4

1 に答える 1

0

テスト->ローカル設定でコードカバレッジがチェックされているため、答えが得られました。だから私は例外クラスをモックするインターフェースを作成しました

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);
    }
}
于 2012-03-27T10:00:17.643 に答える