88namespace  Renci . SshNet . Tests . Classes 
99{ 
1010    [ TestClass ] 
11-     public  class  ServiceFactoryTest_CreateSftpFileReader_FileSizeIsMoreThanTenTimesGreaterThanChunkSize 
11+     public  class  ServiceFactoryTest_CreateSftpFileReader_FileSizeIsMoreThanMaxPendingReadsTimesChunkSize 
1212    { 
1313        private  ServiceFactory  _serviceFactory ; 
1414        private  Mock < ISftpSession >  _sftpSessionMock ; 
@@ -22,18 +22,20 @@ public class ServiceFactoryTest_CreateSftpFileReader_FileSizeIsMoreThanTenTimesG
2222        private  SftpFileAttributes  _fileAttributes ; 
2323        private  long  _fileSize ; 
2424        private  ISftpFileReader  _actual ; 
25+         private  int  _maxPendingReads ; 
2526
2627        private  void  SetupData ( ) 
2728        { 
2829            var  random  =  new  Random ( ) ; 
2930
31+             _maxPendingReads  =  100 ; 
3032            _bufferSize  =  ( uint ) random . Next ( 1 ,  int . MaxValue ) ; 
3133            _openAsyncResult  =  new  SftpOpenAsyncResult ( null ,  null ) ; 
3234            _handle  =  CryptoAbstraction . GenerateRandom ( random . Next ( 1 ,  10 ) ) ; 
3335            _statAsyncResult  =  new  SFtpStatAsyncResult ( null ,  null ) ; 
3436            _fileName  =  random . Next ( ) . ToString ( ) ; 
3537            _chunkSize  =  ( uint )  random . Next ( 1000 ,  5000 ) ; 
36-             _fileSize  =  _chunkSize  *  random . Next ( 11 ,   50 ) ; 
38+             _fileSize  =  _chunkSize  *  random . Next ( _maxPendingReads   +   1 ,   _maxPendingReads   *   2 ) ; 
3739            _fileAttributes  =  new  SftpFileAttributesBuilder ( ) . WithSize ( _fileSize ) . Build ( ) ; 
3840        } 
3941
@@ -63,7 +65,7 @@ private void SetupMocks()
6365                            . Setup ( p =>  p . EndLStat ( _statAsyncResult ) ) 
6466                            . Returns ( _fileAttributes ) ; 
6567            _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 ) ) 
6769                            . Returns ( _sftpFileReaderMock . Object ) ; 
6870        } 
6971
0 commit comments