@@ -213,7 +213,7 @@ public async Task ShouldBrowseSynonyms()
213213 It . IsAny < CancellationToken > ( )
214214 )
215215 )
216- // First call return 1000 Hits
216+ // Only one call since it will take the hit list length and conclude there isn't more
217217 . Returns (
218218 Task . FromResult (
219219 new AlgoliaHttpResponse
@@ -228,56 +228,8 @@ public async Task ShouldBrowseSynonyms()
228228 {
229229 new ( ) { ObjectID = "XXX" , Type = SynonymType . Altcorrection1 } ,
230230 new ( ) { ObjectID = "XXX" , Type = SynonymType . Altcorrection1 } ,
231- } , // Not 1000 but it doesn't matter
232- NbHits = 1000 ,
233- }
234- )
235- )
236- ) ,
237- }
238- )
239- )
240- // Second call return again 1000 Hits
241- . Returns (
242- Task . FromResult (
243- new AlgoliaHttpResponse
244- {
245- HttpStatusCode = 200 ,
246- Body = new MemoryStream (
247- Encoding . UTF8 . GetBytes (
248- serializer . Serialize (
249- new SearchSynonymsResponse ( )
250- {
251- Hits = new List < SynonymHit > ( )
252- {
253- new ( ) { ObjectID = "XXX" , Type = SynonymType . Altcorrection1 } ,
254- new ( ) { ObjectID = "XXX" , Type = SynonymType . Altcorrection1 } ,
255- } , // Not 1000 but it doesn't matter
256- NbHits = 1000 ,
257- }
258- )
259- )
260- ) ,
261- }
262- )
263- )
264- // Third call return 999 Hits
265- . Returns (
266- Task . FromResult (
267- new AlgoliaHttpResponse
268- {
269- HttpStatusCode = 200 ,
270- Body = new MemoryStream (
271- Encoding . UTF8 . GetBytes (
272- serializer . Serialize (
273- new SearchSynonymsResponse
274- {
275- Hits = new List < SynonymHit >
276- {
277- new ( ) { ObjectID = "XXX" , Type = SynonymType . Altcorrection1 } ,
278- new ( ) { ObjectID = "XXX" , Type = SynonymType . Altcorrection1 } ,
279- } , // Not 1000 but it doesn't matter
280- NbHits = 999 ,
231+ } ,
232+ NbHits = 2 ,
281233 }
282234 )
283235 )
@@ -302,10 +254,10 @@ public async Task ShouldBrowseSynonyms()
302254 It . IsAny < TimeSpan > ( ) ,
303255 It . IsAny < CancellationToken > ( )
304256 ) ,
305- Times . Exactly ( 3 )
257+ Times . Exactly ( 1 )
306258 ) ;
307259
308- Assert . Equal ( 6 , browseSynonymsAsync . Count ( ) ) ;
260+ Assert . Equal ( 2 , browseSynonymsAsync . Count ( ) ) ;
309261 }
310262
311263 [ Fact ]
@@ -323,59 +275,7 @@ public async Task ShouldBrowseRules()
323275 It . IsAny < CancellationToken > ( )
324276 )
325277 )
326- // First call return 1000 Hits
327- . Returns (
328- Task . FromResult (
329- new AlgoliaHttpResponse
330- {
331- HttpStatusCode = 200 ,
332- Body = new MemoryStream (
333- Encoding . UTF8 . GetBytes (
334- serializer . Serialize (
335- new SearchRulesResponse
336- {
337- Page = 0 ,
338- NbPages = 2 ,
339- Hits = new List < Rule >
340- {
341- new ( ) { ObjectID = "XXX" } ,
342- new ( ) { ObjectID = "XXX" } ,
343- } , // Not 1000 but it doesn't matter
344- NbHits = 1000 ,
345- }
346- )
347- )
348- ) ,
349- }
350- )
351- )
352- // Second call return again 1000 Hits
353- . Returns (
354- Task . FromResult (
355- new AlgoliaHttpResponse
356- {
357- HttpStatusCode = 200 ,
358- Body = new MemoryStream (
359- Encoding . UTF8 . GetBytes (
360- serializer . Serialize (
361- new SearchRulesResponse
362- {
363- Page = 0 ,
364- NbPages = 2 ,
365- Hits = new List < Rule >
366- {
367- new ( ) { ObjectID = "XXX" } ,
368- new ( ) { ObjectID = "XXX" } ,
369- } , // Not 1000 but it doesn't matter
370- NbHits = 1000 ,
371- }
372- )
373- )
374- ) ,
375- }
376- )
377- )
378- // Third call return 999 Hits
278+ // Only one call since it will take the hit list length and conclude there isn't more
379279 . Returns (
380280 Task . FromResult (
381281 new AlgoliaHttpResponse
@@ -387,13 +287,13 @@ public async Task ShouldBrowseRules()
387287 new SearchRulesResponse
388288 {
389289 Page = 0 ,
390- NbPages = 2 ,
290+ NbPages = 1 ,
391291 Hits = new List < Rule >
392292 {
393293 new ( ) { ObjectID = "XXX" } ,
394294 new ( ) { ObjectID = "XXX" } ,
395- } , // Not 1000 but it doesn't matter
396- NbHits = 999 ,
295+ } ,
296+ NbHits = 2 ,
397297 }
398298 )
399299 )
@@ -416,10 +316,10 @@ public async Task ShouldBrowseRules()
416316 It . IsAny < TimeSpan > ( ) ,
417317 It . IsAny < CancellationToken > ( )
418318 ) ,
419- Times . Exactly ( 3 )
319+ Times . Exactly ( 1 )
420320 ) ;
421321
422- Assert . Equal ( 6 , browseSynonymsAsync . Count ( ) ) ;
322+ Assert . Equal ( 2 , browseSynonymsAsync . Count ( ) ) ;
423323 }
424324
425325 [ Fact ]
0 commit comments