|
6 | 6 | using Ydb.Sdk.Services.Topic.Writer; |
7 | 7 | using Ydb.Topic; |
8 | 8 | using Codec = Ydb.Sdk.Services.Topic.Codec; |
| 9 | +using Range = Moq.Range; |
9 | 10 |
|
10 | 11 | namespace Ydb.Sdk.Tests.Topic; |
11 | 12 |
|
@@ -132,7 +133,7 @@ public async Task Initialize_WhenFailWriteMessage_ShouldRetryInitializeAndReturn |
132 | 133 | // check attempt repeated!!! |
133 | 134 | _mockStream.Verify(stream => stream.Write(It.IsAny<FromClient>()), Times.Exactly(3)); |
134 | 135 | _mockStream.Verify(stream => stream.MoveNextAsync(), |
135 | | - Times.AtLeast(2)); // run processing ack may not be able to start on time |
| 136 | + Times.Between(2, 3, Range.Inclusive)); // run processing ack may not be able to start on time |
136 | 137 | _mockStream.Verify(stream => stream.Current, Times.Exactly(2)); |
137 | 138 | } |
138 | 139 |
|
@@ -180,7 +181,7 @@ public async Task Initialize_WhenFailMoveNextAsync_ShouldRetryInitializeAndRetur |
180 | 181 | // check attempt repeated!!! |
181 | 182 | _mockStream.Verify(stream => stream.Write(It.IsAny<FromClient>()), Times.Exactly(3)); |
182 | 183 | _mockStream.Verify(stream => stream.MoveNextAsync(), |
183 | | - Times.AtLeast(3)); // run processing ack may not be able to start on time |
| 184 | + Times.Between(3, 4, Range.Inclusive)); // run processing ack may not be able to start on time |
184 | 185 | _mockStream.Verify(stream => stream.Current, Times.Exactly(2)); |
185 | 186 | } |
186 | 187 |
|
@@ -257,7 +258,7 @@ public async Task Initialize_WhenInitResponseStatusIsRetryable_ShouldRetryInitia |
257 | 258 | // check attempt repeated!!! |
258 | 259 | _mockStream.Verify(stream => stream.Write(It.IsAny<FromClient>()), Times.Exactly(3)); |
259 | 260 | _mockStream.Verify(stream => stream.MoveNextAsync(), |
260 | | - Times.AtLeast(3)); // run processing ack may not be able to start on time |
| 261 | + Times.Between(3, 4, Range.Inclusive)); // run processing ack may not be able to start on time |
261 | 262 | _mockStream.Verify(stream => stream.Current, Times.Exactly(3)); |
262 | 263 | } |
263 | 264 |
|
@@ -391,7 +392,7 @@ public async Task WriteAsync_WhenTransportExceptionOnWriteInWriterSession_Should |
391 | 392 |
|
392 | 393 | Assert.Equal(PersistenceStatus.Written, (await writer.WriteAsync(100L)).Status); |
393 | 394 | _mockStream.Verify(stream => stream.Write(It.IsAny<FromClient>()), Times.Exactly(4)); |
394 | | - _mockStream.Verify(stream => stream.MoveNextAsync(), Times.AtLeast(4)); |
| 395 | + _mockStream.Verify(stream => stream.MoveNextAsync(), Times.Between(4, 5, Range.Inclusive)); |
395 | 396 | _mockStream.Verify(stream => stream.Current, Times.Exactly(3)); |
396 | 397 | } |
397 | 398 |
|
@@ -466,7 +467,7 @@ public async Task WriteAsync_WhenTransportExceptionOnProcessingWriteAck_ShouldRe |
466 | 467 | Assert.Equal(PersistenceStatus.Written, (await writer.WriteAsync(100L)).Status); |
467 | 468 |
|
468 | 469 | _mockStream.Verify(stream => stream.Write(It.IsAny<FromClient>()), Times.Exactly(3)); |
469 | | - _mockStream.Verify(stream => stream.MoveNextAsync(), Times.AtLeast(4)); |
| 470 | + _mockStream.Verify(stream => stream.MoveNextAsync(), Times.Between(4, 5, Range.Inclusive)); |
470 | 471 | _mockStream.Verify(stream => stream.Current, Times.Exactly(3)); |
471 | 472 | } |
472 | 473 |
|
@@ -543,7 +544,7 @@ public async Task WriteAsync_WhenStreamIsClosingOnProcessingWriteAck_ShouldRecon |
543 | 544 | Assert.Equal(PersistenceStatus.Written, (await writer.WriteAsync(100L)).Status); |
544 | 545 |
|
545 | 546 | _mockStream.Verify(stream => stream.Write(It.IsAny<FromClient>()), Times.Exactly(3)); |
546 | | - _mockStream.Verify(stream => stream.MoveNextAsync(), Times.AtLeast(4)); |
| 547 | + _mockStream.Verify(stream => stream.MoveNextAsync(), Times.Between(4, 5, Range.Inclusive)); |
547 | 548 | _mockStream.Verify(stream => stream.Current, Times.Exactly(3)); |
548 | 549 | } |
549 | 550 |
|
|
0 commit comments