File tree Expand file tree Collapse file tree 7 files changed +17
-12
lines changed
NHSpecificTest/NH1274ExportExclude
Tools/hbm2ddl/SchemaValidator
NHSpecificTest/NH1274ExportExclude
Tools/hbm2ddl/SchemaValidator Expand file tree Collapse file tree 7 files changed +17
-12
lines changed Original file line number Diff line number Diff line change @@ -95,7 +95,7 @@ public void SchemaExport_Validate_CausesValidateExceptionAsync()
9595 Assert . That (
9696 ( ) => validator . ValidateAsync ( ) ,
9797 Throws . TypeOf < SchemaValidationException > ( )
98- . And . Message . EqualTo ( "Schema validation failed: see list of validation errors" )
98+ . And . Message . StartsWith ( "Schema validation failed: see list of validation errors" )
9999 . And . Property ( "ValidationErrors" ) . Contains ( "Missing table: Home_Validate" ) ) ;
100100 }
101101
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ public async Task ShouldBeInvalidIfTimestampTzIsExpectedAndGotTimestampAsync()
3737 var validator = new Tool . hbm2ddl . SchemaValidator ( expected ) ;
3838
3939 var error = Assert . ThrowsAsync < SchemaValidationException > ( ( ) => validator . ValidateAsync ( ) ) ;
40- Assert . That ( error , Has . Message . EqualTo ( "Schema validation failed: see list of validation errors" ) ) ;
40+ Assert . That ( error , Has . Message . StartsWith ( "Schema validation failed: see list of validation errors" ) ) ;
4141 Assert . That (
4242 error ,
4343 Has . Property ( "ValidationErrors" ) . Some . Contains ( "Wrong column type" ) . IgnoreCase
@@ -65,7 +65,7 @@ public async Task ShouldBeInvalidIfTimestampIsExpectedAndGotTimestampTzAsync()
6565 var validator = new Tool . hbm2ddl . SchemaValidator ( expected ) ;
6666
6767 var error = Assert . ThrowsAsync < SchemaValidationException > ( ( ) => validator . ValidateAsync ( ) ) ;
68- Assert . That ( error , Has . Message . EqualTo ( "Schema validation failed: see list of validation errors" ) ) ;
68+ Assert . That ( error , Has . Message . StartsWith ( "Schema validation failed: see list of validation errors" ) ) ;
6969 Assert . That (
7070 error ,
7171 Has . Property ( "ValidationErrors" ) . Some . Contains ( "Wrong column type" ) . IgnoreCase
Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ public void ShouldNotVerifyModifiedTableAsync()
9090 Assert . That (
9191 ( ) => validatorV2 . ValidateAsync ( ) ,
9292 Throws . TypeOf < SchemaValidationException > ( )
93- . And . Message . EqualTo ( "Schema validation failed: see list of validation errors" )
93+ . And . Message . StartsWith ( "Schema validation failed: see list of validation errors" )
9494 . And . Property ( "ValidationErrors" ) . Some . Contains ( "Missing column: Name in " ) . IgnoreCase . And . Contains ( "Version" ) . IgnoreCase ) ;
9595 }
9696
@@ -103,7 +103,7 @@ public void ShouldNotVerifyMultiModifiedTableAsync()
103103
104104 var error = Assert . ThrowsAsync < SchemaValidationException > ( ( ) => validator . ValidateAsync ( ) ) ;
105105 Assert . That ( error ,
106- Has . Message . EqualTo ( "Schema validation failed: see list of validation errors" )
106+ Has . Message . StartsWith ( "Schema validation failed: see list of validation errors" )
107107 . And . Property ( "ValidationErrors" ) . Some . Contains ( "Missing column: Name in " ) . IgnoreCase . And . Contains ( "Version" ) . IgnoreCase ) ;
108108 Assert . That ( error ,
109109 Has . Property ( "ValidationErrors" ) . Some . Contains ( "Missing column: Title in " ) . IgnoreCase . And . Contains ( "Version" ) . IgnoreCase ) ;
Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ public void SchemaExport_Validate_CausesValidateException()
8484 Assert . That (
8585 ( ) => validator . Validate ( ) ,
8686 Throws . TypeOf < SchemaValidationException > ( )
87- . And . Message . EqualTo ( "Schema validation failed: see list of validation errors" )
87+ . And . Message . StartsWith ( "Schema validation failed: see list of validation errors" )
8888 . And . Property ( "ValidationErrors" ) . Contains ( "Missing table: Home_Validate" ) ) ;
8989 }
9090
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ public void ShouldBeInvalidIfTimestampTzIsExpectedAndGotTimestamp()
2626 var validator = new Tool . hbm2ddl . SchemaValidator ( expected ) ;
2727
2828 var error = Assert . Throws < SchemaValidationException > ( ( ) => validator . Validate ( ) ) ;
29- Assert . That ( error , Has . Message . EqualTo ( "Schema validation failed: see list of validation errors" ) ) ;
29+ Assert . That ( error , Has . Message . StartsWith ( "Schema validation failed: see list of validation errors" ) ) ;
3030 Assert . That (
3131 error ,
3232 Has . Property ( "ValidationErrors" ) . Some . Contains ( "Wrong column type" ) . IgnoreCase
@@ -54,7 +54,7 @@ public void ShouldBeInvalidIfTimestampIsExpectedAndGotTimestampTz()
5454 var validator = new Tool . hbm2ddl . SchemaValidator ( expected ) ;
5555
5656 var error = Assert . Throws < SchemaValidationException > ( ( ) => validator . Validate ( ) ) ;
57- Assert . That ( error , Has . Message . EqualTo ( "Schema validation failed: see list of validation errors" ) ) ;
57+ Assert . That ( error , Has . Message . StartsWith ( "Schema validation failed: see list of validation errors" ) ) ;
5858 Assert . That (
5959 error ,
6060 Has . Property ( "ValidationErrors" ) . Some . Contains ( "Wrong column type" ) . IgnoreCase
Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ public void ShouldNotVerifyModifiedTable()
7979 Assert . That (
8080 ( ) => validatorV2 . Validate ( ) ,
8181 Throws . TypeOf < SchemaValidationException > ( )
82- . And . Message . EqualTo ( "Schema validation failed: see list of validation errors" )
82+ . And . Message . StartsWith ( "Schema validation failed: see list of validation errors" )
8383 . And . Property ( "ValidationErrors" ) . Some . Contains ( "Missing column: Name in " ) . IgnoreCase . And . Contains ( "Version" ) . IgnoreCase ) ;
8484 }
8585
@@ -92,7 +92,7 @@ public void ShouldNotVerifyMultiModifiedTable()
9292
9393 var error = Assert . Throws < SchemaValidationException > ( ( ) => validator . Validate ( ) ) ;
9494 Assert . That ( error ,
95- Has . Message . EqualTo ( "Schema validation failed: see list of validation errors" )
95+ Has . Message . StartsWith ( "Schema validation failed: see list of validation errors" )
9696 . And . Property ( "ValidationErrors" ) . Some . Contains ( "Missing column: Name in " ) . IgnoreCase . And . Contains ( "Version" ) . IgnoreCase ) ;
9797 Assert . That ( error ,
9898 Has . Property ( "ValidationErrors" ) . Some . Contains ( "Missing column: Title in " ) . IgnoreCase . And . Contains ( "Version" ) . IgnoreCase ) ;
Original file line number Diff line number Diff line change 33using System . Collections . ObjectModel ;
44using System . Runtime . Serialization ;
55using System . Security ;
6+ using System . Text ;
67
78namespace NHibernate
89{
@@ -36,8 +37,12 @@ public override string Message
3637 var message = base . Message ;
3738 if ( ValidationErrors == null || ValidationErrors . Count == 0 )
3839 return message ;
39- var errors = "ValidationErrors:" + string . Join ( Environment . NewLine + "- " , ValidationErrors ) ;
40- return message + Environment . NewLine + errors ;
40+
41+ var sb = new StringBuilder ( message ) . AppendLine ( ) . AppendLine ( "Validation errors:" ) ;
42+ foreach ( var error in ValidationErrors )
43+ sb . Append ( '-' ) . AppendLine ( error ) ;
44+
45+ return sb . ToString ( ) ;
4146 }
4247 }
4348 }
You can’t perform that action at this time.
0 commit comments