8
8
namespace Renci . SshNet . Tests . Classes
9
9
{
10
10
[ TestClass ]
11
- public class ServiceFactoryTest_CreateSftpFileReader_FileSizeIsMoreThanTenTimesGreaterThanChunkSize
11
+ public class ServiceFactoryTest_CreateSftpFileReader_FileSizeIsMoreThanMaxPendingReadsTimesChunkSize
12
12
{
13
13
private ServiceFactory _serviceFactory ;
14
14
private Mock < ISftpSession > _sftpSessionMock ;
@@ -22,18 +22,20 @@ public class ServiceFactoryTest_CreateSftpFileReader_FileSizeIsMoreThanTenTimesG
22
22
private SftpFileAttributes _fileAttributes ;
23
23
private long _fileSize ;
24
24
private ISftpFileReader _actual ;
25
+ private int _maxPendingReads ;
25
26
26
27
private void SetupData ( )
27
28
{
28
29
var random = new Random ( ) ;
29
30
31
+ _maxPendingReads = 100 ;
30
32
_bufferSize = ( uint ) random . Next ( 1 , int . MaxValue ) ;
31
33
_openAsyncResult = new SftpOpenAsyncResult ( null , null ) ;
32
34
_handle = CryptoAbstraction . GenerateRandom ( random . Next ( 1 , 10 ) ) ;
33
35
_statAsyncResult = new SFtpStatAsyncResult ( null , null ) ;
34
36
_fileName = random . Next ( ) . ToString ( ) ;
35
37
_chunkSize = ( uint ) random . Next ( 1000 , 5000 ) ;
36
- _fileSize = _chunkSize * random . Next ( 11 , 50 ) ;
38
+ _fileSize = _chunkSize * random . Next ( _maxPendingReads + 1 , _maxPendingReads * 2 ) ;
37
39
_fileAttributes = new SftpFileAttributesBuilder ( ) . WithSize ( _fileSize ) . Build ( ) ;
38
40
}
39
41
@@ -63,7 +65,7 @@ private void SetupMocks()
63
65
. Setup ( p => p . EndLStat ( _statAsyncResult ) )
64
66
. Returns ( _fileAttributes ) ;
65
67
_sftpSessionMock . InSequence ( seq )
66
- . Setup ( p => p . CreateFileReader ( _handle , _sftpSessionMock . Object , _chunkSize , 10 , _fileSize ) )
68
+ . Setup ( p => p . CreateFileReader ( _handle , _sftpSessionMock . Object , _chunkSize , _maxPendingReads , _fileSize ) )
67
69
. Returns ( _sftpFileReaderMock . Object ) ;
68
70
}
69
71
0 commit comments