33using System . Linq ;
44using System . Text ;
55using System . Threading . Tasks ;
6+ using Elasticsearch . Net ;
67using FluentAssertions ;
78using Nest ;
89using Tests . Framework ;
@@ -25,8 +26,7 @@ public GetManyApiTests(ReadOnlyCluster cluster)
2526 _client = _cluster . Client ;
2627 }
2728
28- [ I ]
29- public void UsesDefaultIndexAndInferredType ( )
29+ [ I ] public void UsesDefaultIndexAndInferredType ( )
3030 {
3131 var response = _client . GetMany < Developer > ( _ids ) ;
3232 response . Count ( ) . Should ( ) . Be ( 10 ) ;
@@ -39,8 +39,7 @@ public void UsesDefaultIndexAndInferredType()
3939 }
4040 }
4141
42- [ I ]
43- public async Task UsesDefaultIndexAndInferredTypeAsync ( )
42+ [ I ] public async Task UsesDefaultIndexAndInferredTypeAsync ( )
4443 {
4544 var response = await _client . GetManyAsync < Developer > ( _ids ) ;
4645 response . Count ( ) . Should ( ) . Be ( 10 ) ;
@@ -52,5 +51,26 @@ public async Task UsesDefaultIndexAndInferredTypeAsync()
5251 hit . Found . Should ( ) . BeTrue ( ) ;
5352 }
5453 }
54+
55+ [ I ] public async Task CanHandleNotFoundResponses ( )
56+ {
57+ var response = await _client . GetManyAsync < Developer > ( _ids . Select ( i=> i * 100 ) ) ;
58+ response . Count ( ) . Should ( ) . Be ( 10 ) ;
59+ foreach ( var hit in response )
60+ {
61+ hit . Index . Should ( ) . NotBeNullOrWhiteSpace ( ) ;
62+ hit . Type . Should ( ) . NotBeNullOrWhiteSpace ( ) ;
63+ hit . Id . Should ( ) . NotBeNullOrWhiteSpace ( ) ;
64+ hit . Found . Should ( ) . BeFalse ( ) ;
65+ }
66+ }
67+ [ I ] public void ThrowsExceptionOnConnectionError ( )
68+ {
69+ if ( TestClient . RunningFiddler ) return ; //fiddler meddles here
70+
71+ var client = new ElasticClient ( TestClient . CreateSettings ( port : 9500 ) ) ;
72+ Action response = ( ) => client . GetMany < Developer > ( _ids . Select ( i=> i * 100 ) ) ;
73+ response . ShouldThrow < ElasticsearchClientException > ( ) ;
74+ }
5575 }
5676}
0 commit comments