@@ -213,7 +213,7 @@ public async Task ShouldBrowseSynonyms()
213
213
It . IsAny < CancellationToken > ( )
214
214
)
215
215
)
216
- // First call return 1000 Hits
216
+ // Only one call since it will take the hit list length and conclude there isn't more
217
217
. Returns (
218
218
Task . FromResult (
219
219
new AlgoliaHttpResponse
@@ -228,56 +228,8 @@ public async Task ShouldBrowseSynonyms()
228
228
{
229
229
new ( ) { ObjectID = "XXX" , Type = SynonymType . Altcorrection1 } ,
230
230
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 ,
281
233
}
282
234
)
283
235
)
@@ -302,10 +254,10 @@ public async Task ShouldBrowseSynonyms()
302
254
It . IsAny < TimeSpan > ( ) ,
303
255
It . IsAny < CancellationToken > ( )
304
256
) ,
305
- Times . Exactly ( 3 )
257
+ Times . Exactly ( 1 )
306
258
) ;
307
259
308
- Assert . Equal ( 6 , browseSynonymsAsync . Count ( ) ) ;
260
+ Assert . Equal ( 2 , browseSynonymsAsync . Count ( ) ) ;
309
261
}
310
262
311
263
[ Fact ]
@@ -323,59 +275,7 @@ public async Task ShouldBrowseRules()
323
275
It . IsAny < CancellationToken > ( )
324
276
)
325
277
)
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
379
279
. Returns (
380
280
Task . FromResult (
381
281
new AlgoliaHttpResponse
@@ -387,13 +287,13 @@ public async Task ShouldBrowseRules()
387
287
new SearchRulesResponse
388
288
{
389
289
Page = 0 ,
390
- NbPages = 2 ,
290
+ NbPages = 1 ,
391
291
Hits = new List < Rule >
392
292
{
393
293
new ( ) { ObjectID = "XXX" } ,
394
294
new ( ) { ObjectID = "XXX" } ,
395
- } , // Not 1000 but it doesn't matter
396
- NbHits = 999 ,
295
+ } ,
296
+ NbHits = 2 ,
397
297
}
398
298
)
399
299
)
@@ -416,10 +316,10 @@ public async Task ShouldBrowseRules()
416
316
It . IsAny < TimeSpan > ( ) ,
417
317
It . IsAny < CancellationToken > ( )
418
318
) ,
419
- Times . Exactly ( 3 )
319
+ Times . Exactly ( 1 )
420
320
) ;
421
321
422
- Assert . Equal ( 6 , browseSynonymsAsync . Count ( ) ) ;
322
+ Assert . Equal ( 2 , browseSynonymsAsync . Count ( ) ) ;
423
323
}
424
324
425
325
[ Fact ]
0 commit comments