2012-03-26 9 views
0

Ich verwende EnterpriseLibrary.ExceptionHandling Version 5 für die Fehlerbehandlung. Perfekt im Projekt arbeiten. Aber wenn alle Unittest in Projekt immer Fehler ausgeführt:.Net Komponententest EnterpriseLibrary.ExceptionHandling Problem

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.

Obwohl, wenn ich den speziellen Test nur im Debug-Modus arbeitet gut laufen wie erwartet.

Bitte vorschlagen. Danke

+0

Dank LU RD für die Bearbeitung erstellt. – Arvind

Antwort

0

Ich habe die Antwort bekommen, weil Code Coverage in Test -> Lokale Einstellungen aktiviert ist. Also habe ich eine Schnittstelle zum Mock der Ausnahmeklasse wie

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