From 0258824615ef9c255cbf6a6276c3775e8dba4342 Mon Sep 17 00:00:00 2001 From: Pedro Fonseca Date: Mon, 30 Aug 2021 22:13:07 +0200 Subject: [PATCH] Adjust SFTP FileReader testcases to accept new MaxPendingReads values --- ...er_FileSizeIsMoreThanMaxPendingReadsTimesChunkSize.cs} | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) rename src/Renci.SshNet.Tests/Classes/{ServiceFactoryTest_CreateSftpFileReader_FileSizeIsMoreThanTenTimesGreaterThanChunkSize.cs => ServiceFactoryTest_CreateSftpFileReader_FileSizeIsMoreThanMaxPendingReadsTimesChunkSize.cs} (92%) diff --git a/src/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsMoreThanTenTimesGreaterThanChunkSize.cs b/src/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsMoreThanMaxPendingReadsTimesChunkSize.cs similarity index 92% rename from src/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsMoreThanTenTimesGreaterThanChunkSize.cs rename to src/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsMoreThanMaxPendingReadsTimesChunkSize.cs index dad634472..8fe220c80 100644 --- a/src/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsMoreThanTenTimesGreaterThanChunkSize.cs +++ b/src/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsMoreThanMaxPendingReadsTimesChunkSize.cs @@ -8,7 +8,7 @@ namespace Renci.SshNet.Tests.Classes { [TestClass] - public class ServiceFactoryTest_CreateSftpFileReader_FileSizeIsMoreThanTenTimesGreaterThanChunkSize + public class ServiceFactoryTest_CreateSftpFileReader_FileSizeIsMoreThanMaxPendingReadsTimesChunkSize { private ServiceFactory _serviceFactory; private Mock _sftpSessionMock; @@ -22,18 +22,20 @@ public class ServiceFactoryTest_CreateSftpFileReader_FileSizeIsMoreThanTenTimesG private SftpFileAttributes _fileAttributes; private long _fileSize; private ISftpFileReader _actual; + private int _maxPendingReads; private void SetupData() { var random = new Random(); + _maxPendingReads = 100; _bufferSize = (uint)random.Next(1, int.MaxValue); _openAsyncResult = new SftpOpenAsyncResult(null, null); _handle = CryptoAbstraction.GenerateRandom(random.Next(1, 10)); _statAsyncResult = new SFtpStatAsyncResult(null, null); _fileName = random.Next().ToString(); _chunkSize = (uint) random.Next(1000, 5000); - _fileSize = _chunkSize * random.Next(11, 50); + _fileSize = _chunkSize * random.Next(_maxPendingReads + 1, _maxPendingReads * 2); _fileAttributes = new SftpFileAttributesBuilder().WithSize(_fileSize).Build(); } @@ -63,7 +65,7 @@ private void SetupMocks() .Setup(p => p.EndLStat(_statAsyncResult)) .Returns(_fileAttributes); _sftpSessionMock.InSequence(seq) - .Setup(p => p.CreateFileReader(_handle, _sftpSessionMock.Object, _chunkSize, 10, _fileSize)) + .Setup(p => p.CreateFileReader(_handle, _sftpSessionMock.Object, _chunkSize, _maxPendingReads, _fileSize)) .Returns(_sftpFileReaderMock.Object); }