File tree 1 file changed +26
-0
lines changed
1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -758,5 +758,31 @@ public async Task DeleteAllExistingDocuments()
758
758
var docs = await index . GetDocumentsAsync < Movie > ( ) ;
759
759
docs . Results . Should ( ) . BeEmpty ( ) ;
760
760
}
761
+
762
+ [ Fact ]
763
+ public async Task CanFetchMultipleDocumentsByIds ( )
764
+ {
765
+ var indexUID = nameof ( CanFetchMultipleDocumentsByIds ) ;
766
+ var index = _client . Index ( indexUID ) ;
767
+
768
+ var documents = new [ ]
769
+ {
770
+ new Movie { Id = "1" , Name = "The Matrix" } ,
771
+ new Movie { Id = "2" , Name = "Inception" } ,
772
+ new Movie { Id = "3" , Name = "Arrival" }
773
+ } ;
774
+
775
+ var task = await index . AddDocumentsAsync ( documents ) ;
776
+ await index . WaitForTaskAsync ( task . TaskUid ) ;
777
+
778
+ // Fetch by IDs
779
+ var idsToFetch = new List < string > { "1" , "3" } ;
780
+ var fetched = await index . GetDocumentsAsync < Movie > ( idsToFetch ) ;
781
+ var resultDocs = fetched . Results . ToList ( ) ;
782
+
783
+ Assert . Equal ( 2 , resultDocs . Count ) ;
784
+ Assert . Contains ( resultDocs , d => d . Id == "1" && d . Name == "The Matrix" ) ;
785
+ Assert . Contains ( resultDocs , d => d . Id == "3" && d . Name == "Arrival" ) ;
786
+ }
761
787
}
762
788
}
You can’t perform that action at this time.
0 commit comments