File tree Expand file tree Collapse file tree
TestStack.ConventionTests/Internal Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,9 +9,11 @@ public class ConventionResult : IConventionResult
99 {
1010 readonly List < ResultInfo > conventionResults ;
1111 readonly string dataDescription ;
12+ readonly IList < IReportDataFormatter > formatters ;
1213
13- public ConventionResult ( string dataDescription )
14+ public ConventionResult ( string dataDescription , IList < IReportDataFormatter > formatters )
1415 {
16+ this . formatters = formatters ;
1517 this . dataDescription = dataDescription ;
1618 conventionResults = new List < ResultInfo > ( ) ;
1719 }
@@ -62,10 +64,9 @@ public void IsSymmetric<TResult>(
6264 secondSetFailureTitle , secondSetFailingData ) ;
6365 }
6466
65- static ConventionReportFailure FormatData < T > ( T failingData )
67+ ConventionReportFailure FormatData < T > ( T failingData )
6668 {
67- var formatter = Convention . Formatters . FirstOrDefault ( f => f . CanFormat ( failingData ) ) ;
68-
69+ var formatter = formatters . FirstOrDefault ( f => f . CanFormat ( failingData ) ) ;
6970 if ( formatter == null )
7071 {
7172 throw new NoDataFormatterFoundException (
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ public static ResultInfo[] GetConventionResults<TDataSource>(IConvention<TDataSo
1111 if ( ! data . HasData )
1212 throw new ConventionSourceInvalidException ( string . Format ( "{0} has no data" , data . Description ) ) ;
1313
14- var resultGatherer = new ConventionResult ( data . Description ) ;
14+ var resultGatherer = new ConventionResult ( data . Description , Convention . Formatters ) ;
1515 convention . Execute ( data , resultGatherer ) ;
1616
1717 return resultGatherer . ConventionResults ;
@@ -26,7 +26,7 @@ public static ResultInfo[] GetConventionResultsWithApprovedExeptions<TDataSource
2626 if ( ! data . HasData )
2727 throw new ConventionSourceInvalidException ( string . Format ( "{0} has no data" , data . Description ) ) ;
2828
29- var resultGatherer = new ConventionResult ( data . Description ) ;
29+ var resultGatherer = new ConventionResult ( data . Description , Convention . Formatters ) ;
3030 convention . Execute ( data , resultGatherer ) ;
3131 foreach ( var conventionResult in resultGatherer . ConventionResults )
3232 {
You can’t perform that action at this time.
0 commit comments