1010 public static class Convention
1111 {
1212 static readonly HtmlReportRenderer HtmlRenderer = new HtmlReportRenderer ( AssemblyDirectory ) ;
13- static readonly List < ConventionResult > Reports = new List < ConventionResult > ( ) ;
1413
1514 static Convention ( )
1615 {
@@ -24,38 +23,41 @@ static Convention()
2423 } ;
2524 }
2625
27- public static IEnumerable < ConventionResult > ConventionReports { get { return Reports ; } }
28- public static IList < IReportDataFormatter > Formatters { get ; set ; }
26+ public static IList < IReportDataFormatter > Formatters { get ; set ; }
2927
3028 public static void Is < TDataSource > ( IConvention < TDataSource > convention , TDataSource data )
3129 where TDataSource : IConventionData
3230 {
33- Is ( convention , data , new ThrowOnFailureResultsProcessor ( ) ) ;
31+ Is ( convention , data , new IResultsProcessor [ ]
32+ {
33+ HtmlRenderer ,
34+ new ConventionReportTraceRenderer ( ) ,
35+ new ThrowOnFailureResultsProcessor ( )
36+ } ) ;
3437 }
3538
3639 public static void Is < TDataSource > ( IConvention < TDataSource > convention , TDataSource data ,
37- IResultsProcessor processor )
40+ IResultsProcessor [ ] processors )
3841 where TDataSource : IConventionData
3942 {
40- try
41- {
42- var context = new ConventionContext ( data . Description , Formatters ) ;
43- var conventionResult = context . Execute ( convention , data ) ;
44- Reports . AddRange ( conventionResult ) ;
43+ var context = new ConventionContext ( data . Description , Formatters ) ;
44+ var conventionResult = context . Execute ( convention , data ) ;
4545
46- new ConventionReportTraceRenderer ( ) . Process ( conventionResult ) ;
47- processor . Process ( conventionResult ) ;
48- }
49- finally
46+ foreach ( var processor in processors )
5047 {
51- HtmlRenderer . Process ( Reports . ToArray ( ) ) ;
48+ processor . Process ( conventionResult ) ;
5249 }
5350 }
5451
5552 public static void IsWithApprovedExeptions < TDataSource > ( IConvention < TDataSource > convention , TDataSource data )
5653 where TDataSource : IConventionData
5754 {
58- Is ( convention , data , new ApproveResultsProcessor ( ) ) ;
55+ Is ( convention , data , new IResultsProcessor [ ]
56+ {
57+ HtmlRenderer ,
58+ new ConventionReportTraceRenderer ( ) ,
59+ new ApproveResultsProcessor ( )
60+ } ) ;
5961 }
6062
6163 // http://stackoverflow.com/questions/52797/c-how-do-i-get-the-path-of-the-assembly-the-code-is-in#answer-283917
0 commit comments