File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed
TestStack.ConventionTests/Internal Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -9,9 +9,11 @@ public class ConventionResult : IConventionResult
9
9
{
10
10
readonly List < ResultInfo > conventionResults ;
11
11
readonly string dataDescription ;
12
+ readonly IList < IReportDataFormatter > formatters ;
12
13
13
- public ConventionResult ( string dataDescription )
14
+ public ConventionResult ( string dataDescription , IList < IReportDataFormatter > formatters )
14
15
{
16
+ this . formatters = formatters ;
15
17
this . dataDescription = dataDescription ;
16
18
conventionResults = new List < ResultInfo > ( ) ;
17
19
}
@@ -62,10 +64,9 @@ public void IsSymmetric<TResult>(
62
64
secondSetFailureTitle , secondSetFailingData ) ;
63
65
}
64
66
65
- static ConventionReportFailure FormatData < T > ( T failingData )
67
+ ConventionReportFailure FormatData < T > ( T failingData )
66
68
{
67
- var formatter = Convention . Formatters . FirstOrDefault ( f => f . CanFormat ( failingData ) ) ;
68
-
69
+ var formatter = formatters . FirstOrDefault ( f => f . CanFormat ( failingData ) ) ;
69
70
if ( formatter == null )
70
71
{
71
72
throw new NoDataFormatterFoundException (
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ public static ResultInfo[] GetConventionResults<TDataSource>(IConvention<TDataSo
11
11
if ( ! data . HasData )
12
12
throw new ConventionSourceInvalidException ( string . Format ( "{0} has no data" , data . Description ) ) ;
13
13
14
- var resultGatherer = new ConventionResult ( data . Description ) ;
14
+ var resultGatherer = new ConventionResult ( data . Description , Convention . Formatters ) ;
15
15
convention . Execute ( data , resultGatherer ) ;
16
16
17
17
return resultGatherer . ConventionResults ;
@@ -26,7 +26,7 @@ public static ResultInfo[] GetConventionResultsWithApprovedExeptions<TDataSource
26
26
if ( ! data . HasData )
27
27
throw new ConventionSourceInvalidException ( string . Format ( "{0} has no data" , data . Description ) ) ;
28
28
29
- var resultGatherer = new ConventionResult ( data . Description ) ;
29
+ var resultGatherer = new ConventionResult ( data . Description , Convention . Formatters ) ;
30
30
convention . Execute ( data , resultGatherer ) ;
31
31
foreach ( var conventionResult in resultGatherer . ConventionResults )
32
32
{
You can’t perform that action at this time.
0 commit comments