@@ -28,6 +28,11 @@ public BaseJsonTests()
2828 }
2929
3030 protected void JsonEquals ( object o , MethodBase method , string fileName = null )
31+ {
32+ var json = TestElasticClient . Serialize ( o ) ;
33+ this . JsonEquals ( json , method , fileName ) ;
34+ }
35+ protected void JsonEquals ( string json , MethodBase method , string fileName = null )
3136 {
3237 var type = method . DeclaringType ;
3338 var @namespace = method . DeclaringType . Namespace ;
@@ -36,18 +41,27 @@ protected void JsonEquals(object o, MethodBase method, string fileName = null)
3641 var file = Path . Combine ( folder , ( fileName ?? method . Name ) + ".json" ) ;
3742 file = Path . Combine ( Environment . CurrentDirectory . Replace ( "bin\\ Debug" , "" ) . Replace ( "bin\\ Release" , "" ) , file ) ;
3843
39- var json = TestElasticClient . Serialize ( o ) ;
44+
4045 var expected = File . ReadAllText ( file ) ;
4146 Assert . True ( json . JsonEquals ( expected ) , json ) ;
4247 }
43- protected void JsonEquals ( string json , MethodBase method )
48+ protected void JsonNotEquals ( object o , MethodBase method , string fileName = null )
49+ {
50+ var json = TestElasticClient . Serialize ( o ) ;
51+ this . JsonNotEquals ( json , method , fileName ) ;
52+ }
53+ protected void JsonNotEquals ( string json , MethodBase method , string fileName = null )
4454 {
4555 var type = method . DeclaringType ;
4656 var @namespace = method . DeclaringType . Namespace ;
4757 var folder = @namespace . Replace ( "Nest.Tests.Unit." , "" ) . Replace ( "." , "\\ " ) ;
48- var file = Path . Combine ( folder , method . Name + ".json" ) ;
58+
59+ var file = Path . Combine ( folder , ( fileName ?? method . Name ) + ".json" ) ;
60+ file = Path . Combine ( Environment . CurrentDirectory . Replace ( "bin\\ Debug" , "" ) . Replace ( "bin\\ Release" , "" ) , file ) ;
61+
62+
4963 var expected = File . ReadAllText ( file ) ;
50- Assert . True ( json . JsonEquals ( expected ) , json ) ;
64+ Assert . False ( json . JsonEquals ( expected ) , json ) ;
5165 }
5266 }
5367}
0 commit comments