33 using System ;
44 using System . Collections . Generic ;
55 using System . IO ;
6- using System . Linq ;
76 using System . Reflection ;
87 using ApprovalTests ;
98 using ApprovalTests . Core . Exceptions ;
10- using TestStack . ConventionTests . Conventions ;
119 using TestStack . ConventionTests . Internal ;
1210 using TestStack . ConventionTests . Reporting ;
1311
@@ -42,8 +40,8 @@ public static void Is<TDataSource>(IConvention<TDataSource> convention, TDataSou
4240 {
4341 try
4442 {
45- var conventionResult = Executor . GetConventionReport ( convention . ConventionTitle , convention . GetFailingData ( data ) . ToArray ( ) , data ) ;
46- Reports . Add ( conventionResult ) ;
43+ var conventionResult = Executor . GetConventionResults ( convention , data ) ;
44+ Reports . AddRange ( conventionResult ) ;
4745
4846 new ConventionReportTraceRenderer ( ) . Render ( conventionResult ) ;
4947 reporter . Render ( conventionResult ) ;
@@ -57,8 +55,8 @@ public static void Is<TDataSource>(IConvention<TDataSource> convention, TDataSou
5755 public static void IsWithApprovedExeptions < TDataSource > ( IConvention < TDataSource > convention , TDataSource data )
5856 where TDataSource : IConventionData
5957 {
60- var conventionResult = Executor . GetConventionReportWithApprovedExeptions ( convention . ConventionTitle , convention . GetFailingData ( data ) . ToArray ( ) , data ) ;
61- Reports . Add ( conventionResult ) ;
58+ var conventionResult = Executor . GetConventionResultsWithApprovedExeptions ( convention , data ) ;
59+ Reports . AddRange ( conventionResult ) ;
6260
6361 try
6462 {
@@ -78,60 +76,6 @@ public static void IsWithApprovedExeptions<TDataSource>(IConvention<TDataSource>
7876 }
7977 }
8078
81- public static void Is < TDataSource > ( ISymmetricConvention < TDataSource > convention , TDataSource data )
82- where TDataSource : IConventionData
83- {
84- Is ( convention , data , new ConventionResultExceptionReporter ( ) ) ;
85- }
86-
87- public static void Is < TDataSource > ( ISymmetricConvention < TDataSource > convention , TDataSource data , IConventionReportRenderer reporter )
88- where TDataSource : IConventionData
89- {
90- try
91- {
92- var conventionResult = Executor . GetConventionReport ( convention . ConventionTitle , convention . GetFailingData ( data ) . ToArray ( ) , data ) ;
93- var inverseConventionResult = Executor . GetConventionReport ( convention . InverseTitle , convention . GetFailingInverseData ( data ) . ToArray ( ) , data ) ;
94-
95- Reports . Add ( conventionResult ) ;
96- Reports . Add ( inverseConventionResult ) ;
97-
98- new ConventionReportTraceRenderer ( ) . Render ( conventionResult , inverseConventionResult ) ;
99- reporter . Render ( conventionResult , inverseConventionResult ) ;
100- }
101- finally
102- {
103- HtmlRenderer . Render ( Reports . ToArray ( ) ) ;
104- }
105- }
106-
107- public static void IsWithApprovedExeptions < TDataSource > ( ISymmetricConvention < TDataSource > convention , TDataSource data )
108- where TDataSource : IConventionData
109- {
110- var conventionResult = Executor . GetConventionReportWithApprovedExeptions ( convention . ConventionTitle , convention . GetFailingData ( data ) . ToArray ( ) , data ) ;
111- var inverseConventionResult = Executor . GetConventionReportWithApprovedExeptions ( convention . InverseTitle , convention . GetFailingInverseData ( data ) . ToArray ( ) , data ) ;
112- Reports . Add ( conventionResult ) ;
113- Reports . Add ( inverseConventionResult ) ;
114-
115- try
116- {
117- //Render both, with approved exceptions included
118- var conventionReportTextRenderer = new ConventionReportTextRenderer ( ) ;
119- conventionReportTextRenderer . Render ( conventionResult , inverseConventionResult ) ;
120- Approvals . Verify ( conventionReportTextRenderer . Output ) ;
121-
122- // Trace on success
123- new ConventionReportTraceRenderer ( ) . Render ( conventionResult , inverseConventionResult ) ;
124- }
125- catch ( ApprovalException ex )
126- {
127- throw new ConventionFailedException ( "Approved exceptions for convention differs\r \n \r \n " + ex . Message , ex ) ;
128- }
129- finally
130- {
131- HtmlRenderer . Render ( Reports . ToArray ( ) ) ;
132- }
133- }
134-
13579 // http://stackoverflow.com/questions/52797/c-how-do-i-get-the-path-of-the-assembly-the-code-is-in#answer-283917
13680 static string AssemblyDirectory
13781 {
0 commit comments