2012-03-26 57 views
0

我正在使用EnterpriseLibrary.ExceptionHandling Version 5进行错误处理。在项目中工作完美。但是,当项目得到错误运行所有单元测试:.Net单元测试EnterpriseLibrary.Exception处理问题

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.

虽然如果我只在调试模式下运行特定的测试工作正常预期。

请建议。谢谢

+0

感谢LU RD进行编辑。 – Arvind 2012-03-27 10:02:37

回答

0

我得到的答案是Code Coverage的原因是在测试 - >本地设置。 所以我创建了一个模拟异常类的界面,如

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); 
    } 
}