11using System ;
22using System . Collections . Generic ;
3+ using System . Linq ;
34using Elastic . Xunit . XunitPlumbing ;
45using FluentAssertions ;
56using Tests . Core . Client ;
@@ -19,7 +20,30 @@ public void ShouldDeserialize()
1920 {
2021 total = 1 ,
2122 successful = 1 ,
22- failed = 0
23+ failed = 0 ,
24+ failures = new [ ]
25+ {
26+ new
27+ {
28+ type = "illegal_argument_exception" ,
29+ reason = "failed to execute script" ,
30+ caused_by = new
31+ {
32+ type = "script_exception" ,
33+ reason = "failed to run inline script [use(java.lang.Exception) {throw new Exception(\" Customized Exception\" )}] using lang [groovy]" ,
34+ caused_by = new
35+ {
36+ type = "privileged_action_exception" ,
37+ reason = ( string ) null ,
38+ caused_by = new
39+ {
40+ type = "exception" ,
41+ reason = "Custom Exception"
42+ }
43+ }
44+ }
45+ }
46+ }
2347 } ,
2448 cluster_name = "my_cluster" ,
2549 nodes = new Dictionary < string , object >
@@ -54,6 +78,11 @@ public void ShouldDeserialize()
5478 response . NodeStatistics . Total . Should ( ) . Be ( 1 ) ;
5579 response . NodeStatistics . Successful . Should ( ) . Be ( 1 ) ;
5680 response . NodeStatistics . Failed . Should ( ) . Be ( 0 ) ;
81+ response . NodeStatistics . Failures . Should ( ) . HaveCount ( 1 ) ;
82+ var failure = response . NodeStatistics . Failures . First ( ) ;
83+ failure . Type . Should ( ) . NotBeNull ( ) ;
84+ failure . Reason . Should ( ) . NotBeNull ( ) ;
85+ failure . CausedBy . Should ( ) . NotBeNull ( ) ;
5786
5887 response . Nodes . Should ( ) . NotBeNull ( ) ;
5988 response . Nodes . Should ( ) . HaveCount ( 1 ) ;
0 commit comments