From b0d01df91f79195658778dd21717369b02150bf1 Mon Sep 17 00:00:00 2001 From: Rob Hague Date: Fri, 22 Dec 2023 07:37:30 +0000 Subject: [PATCH] Try to stabilise a few tests (#1278) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Try to stabilise a few tests * Fix random 0 buffer sizes --------- Co-authored-by: Wojciech Nagórski --- .../OldIntegrationTests/SshCommandTest.cs | 12 ++++-------- test/Renci.SshNet.IntegrationTests/SftpTests.cs | 7 +------ ...est_Dispose_SessionIsConnectedAndChannelIsOpen.cs | 2 ++ ...ForwardedPortRemoteTest_Start_PortNeverStarted.cs | 2 ++ .../Classes/SessionTest_Connected.cs | 6 ++++++ ...tpFileStreamTest_CanRead_Closed_FileAccessRead.cs | 4 ++-- ...eStreamTest_CanRead_Closed_FileAccessReadWrite.cs | 6 +++--- ...pFileStreamTest_CanRead_Closed_FileAccessWrite.cs | 6 +++--- ...FileStreamTest_CanRead_Disposed_FileAccessRead.cs | 6 +++--- ...treamTest_CanRead_Disposed_FileAccessReadWrite.cs | 6 +++--- ...ileStreamTest_CanRead_Disposed_FileAccessWrite.cs | 6 +++--- ...pFileStreamTest_CanWrite_Closed_FileAccessRead.cs | 6 +++--- ...StreamTest_CanWrite_Closed_FileAccessReadWrite.cs | 6 +++--- ...FileStreamTest_CanWrite_Closed_FileAccessWrite.cs | 6 +++--- ...ileStreamTest_CanWrite_Disposed_FileAccessRead.cs | 6 +++--- ...reamTest_CanWrite_Disposed_FileAccessReadWrite.cs | 6 +++--- ...leStreamTest_CanWrite_Disposed_FileAccessWrite.cs | 6 +++--- .../Sftp/SftpFileStreamTest_Close_Disposed.cs | 4 ++-- .../Sftp/SftpFileStreamTest_Close_SessionNotOpen.cs | 4 ++-- .../Sftp/SftpFileStreamTest_Close_SessionOpen.cs | 4 ++-- .../Sftp/SftpFileStreamTest_Dispose_Closed.cs | 4 ++-- .../Sftp/SftpFileStreamTest_Dispose_Disposed.cs | 4 ++-- .../SftpFileStreamTest_Dispose_SessionNotOpen.cs | 4 ++-- .../Sftp/SftpFileStreamTest_Dispose_SessionOpen.cs | 4 ++-- .../Sftp/SftpFileStreamTest_Finalize_SessionOpen.cs | 4 ++-- ...e_NoDataInWriteBufferAndNoDataInReadBuffer_Eof.cs | 4 ++-- .../Sftp/SftpFileStreamTest_SetLength_Disposed.cs | 4 ++-- .../SftpFileStreamTest_SetLength_SessionNotOpen.cs | 4 ++-- ...treamTest_SetLength_SessionOpen_FIleAccessRead.cs | 4 ++-- ...Test_SetLength_SessionOpen_FIleAccessReadWrite.cs | 4 ++-- ...reamTest_SetLength_SessionOpen_FIleAccessWrite.cs | 4 ++-- 31 files changed, 78 insertions(+), 77 deletions(-) diff --git a/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SshCommandTest.cs b/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SshCommandTest.cs index d852a093a..e5e78a762 100644 --- a/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SshCommandTest.cs +++ b/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SshCommandTest.cs @@ -290,13 +290,11 @@ public void Test_Execute_Command_Asynchronously_With_Callback() { callbackCalled = true; }), null); - while (!asyncResult.IsCompleted) - { - Thread.Sleep(100); - } cmd.EndExecute(asyncResult); + Thread.Sleep(100); + Assert.IsTrue(callbackCalled); client.Disconnect(); @@ -318,13 +316,11 @@ public void Test_Execute_Command_Asynchronously_With_Callback_On_Different_Threa { callbackThreadId = Thread.CurrentThread.ManagedThreadId; }), null); - while (!asyncResult.IsCompleted) - { - Thread.Sleep(100); - } cmd.EndExecute(asyncResult); + Thread.Sleep(100); + Assert.AreNotEqual(currentThreadId, callbackThreadId); client.Disconnect(); diff --git a/test/Renci.SshNet.IntegrationTests/SftpTests.cs b/test/Renci.SshNet.IntegrationTests/SftpTests.cs index e6f40c05e..ee00bb15e 100644 --- a/test/Renci.SshNet.IntegrationTests/SftpTests.cs +++ b/test/Renci.SshNet.IntegrationTests/SftpTests.cs @@ -6230,19 +6230,14 @@ public void Sftp_SetLastWriteTimeUtc() client.Connect(); using var fileStream = new MemoryStream(Encoding.UTF8.GetBytes(testContent)); - var currentTime = DateTime.UtcNow; client.UploadFile(fileStream, testFilePath); try { - var time = client.GetLastWriteTimeUtc(testFilePath); - - DateTimeAssert.AreEqual(currentTime.TruncateToWholeSeconds(), time); - var newTime = new DateTime(1986, 03, 15, 01, 02, 03, 123, DateTimeKind.Utc); client.SetLastWriteTimeUtc(testFilePath, newTime); - time = client.GetLastWriteTimeUtc(testFilePath); + var time = client.GetLastWriteTimeUtc(testFilePath); DateTimeAssert.AreEqual(newTime.TruncateToWholeSeconds(), time); } diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelDirectTcpipTest_Dispose_SessionIsConnectedAndChannelIsOpen.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelDirectTcpipTest_Dispose_SessionIsConnectedAndChannelIsOpen.cs index 6ccda5c82..cf6d17bb0 100644 --- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelDirectTcpipTest_Dispose_SessionIsConnectedAndChannelIsOpen.cs +++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelDirectTcpipTest_Dispose_SessionIsConnectedAndChannelIsOpen.cs @@ -175,6 +175,8 @@ private void Arrange() private void Act() { _channel?.Dispose(); + + Thread.Sleep(200); } [TestMethod] diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortNeverStarted.cs index 4b6a420d4..a090f289b 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortNeverStarted.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortNeverStarted.cs @@ -122,6 +122,8 @@ public void ForwardedPortShouldAcceptNewConnections() new ForwardedTcpipChannelInfo(_forwardedPort.BoundHost, _forwardedPort.BoundPort, originatorAddress, originatorPort)))); + Thread.Sleep(200); + _sessionMock.Verify(p => p.CreateChannelForwardedTcpip(channelNumber, initialWindowSize, maximumPacketSize), Times.Once); channelMock.Verify(p => p.Bind(It.Is(ep => ep.Address.Equals(_remoteEndpoint.Address) && ep.Port == _remoteEndpoint.Port), _forwardedPort), Times.Once); channelMock.Verify(p => p.Dispose(), Times.Once); diff --git a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected.cs b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected.cs index f841926b4..e4f7f2430 100644 --- a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected.cs +++ b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected.cs @@ -45,6 +45,8 @@ public void IsConnectedShouldReturnTrue() [TestMethod] public void SendMessageShouldSendPacketToServer() { + Thread.Sleep(100); + ServerBytesReceivedRegister.Clear(); Session.SendMessage(_ignoreMessage); @@ -123,6 +125,8 @@ public void ISession_MessageListenerCompletedShouldNotBeSignaled() [TestMethod] public void ISession_SendMessageShouldSendPacketToServer() { + Thread.Sleep(100); + var session = (ISession) Session; ServerBytesReceivedRegister.Clear(); @@ -137,6 +141,8 @@ public void ISession_SendMessageShouldSendPacketToServer() [TestMethod] public void ISession_TrySendMessageShouldSendPacketToServerAndReturnTrue() { + Thread.Sleep(100); + var session = (ISession) Session; ServerBytesReceivedRegister.Clear(); diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Closed_FileAccessRead.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Closed_FileAccessRead.cs index aaa62c856..87ff5fbec 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Closed_FileAccessRead.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Closed_FileAccessRead.cs @@ -25,8 +25,8 @@ protected override void SetupData() _path = random.Next().ToString(); _handle = GenerateRandom(3, random); _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(0, 1000); - _writeBufferSize = (uint) random.Next(0, 1000); + _readBufferSize = (uint) random.Next(1, 1000); + _writeBufferSize = (uint) random.Next(1, 1000); } protected override void SetupMocks() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Closed_FileAccessReadWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Closed_FileAccessReadWrite.cs index b5b9b8636..2ae877f3b 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Closed_FileAccessReadWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Closed_FileAccessReadWrite.cs @@ -24,9 +24,9 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(3, random); - _bufferSize = (uint) random.Next(0, 1000); - _readBufferSize = (uint) random.Next(0, 1000); - _writeBufferSize = (uint) random.Next(0, 1000); + _bufferSize = (uint) random.Next(1, 1000); + _readBufferSize = (uint) random.Next(1, 1000); + _writeBufferSize = (uint) random.Next(1, 1000); } protected override void SetupMocks() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Closed_FileAccessWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Closed_FileAccessWrite.cs index 3817f6bcb..e82b347a2 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Closed_FileAccessWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Closed_FileAccessWrite.cs @@ -24,9 +24,9 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(3, random); - _bufferSize = (uint) random.Next(0, 1000); - _readBufferSize = (uint) random.Next(0, 1000); - _writeBufferSize = (uint) random.Next(0, 1000); + _bufferSize = (uint) random.Next(1, 1000); + _readBufferSize = (uint) random.Next(1, 1000); + _writeBufferSize = (uint) random.Next(1, 1000); } protected override void SetupMocks() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Disposed_FileAccessRead.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Disposed_FileAccessRead.cs index bbbcb6243..a1ab8bec8 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Disposed_FileAccessRead.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Disposed_FileAccessRead.cs @@ -24,9 +24,9 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(1, random); - _bufferSize = (uint) random.Next(0, 1000); - _readBufferSize = (uint) random.Next(0, 1000); - _writeBufferSize = (uint) random.Next(0, 1000); + _bufferSize = (uint) random.Next(1, 1000); + _readBufferSize = (uint) random.Next(1, 1000); + _writeBufferSize = (uint) random.Next(1, 1000); } protected override void SetupMocks() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Disposed_FileAccessReadWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Disposed_FileAccessReadWrite.cs index 93736b6fe..97d7df8f4 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Disposed_FileAccessReadWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Disposed_FileAccessReadWrite.cs @@ -24,9 +24,9 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(1, random); - _bufferSize = (uint) random.Next(0, 1000); - _readBufferSize = (uint) random.Next(0, 1000); - _writeBufferSize = (uint) random.Next(0, 1000); + _bufferSize = (uint) random.Next(1, 1000); + _readBufferSize = (uint) random.Next(1, 1000); + _writeBufferSize = (uint) random.Next(1, 1000); } protected override void SetupMocks() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Disposed_FileAccessWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Disposed_FileAccessWrite.cs index 94d6be78f..d6b4856e1 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Disposed_FileAccessWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Disposed_FileAccessWrite.cs @@ -24,9 +24,9 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(1, random); - _bufferSize = (uint) random.Next(0, 1000); - _readBufferSize = (uint) random.Next(0, 1000); - _writeBufferSize = (uint) random.Next(0, 1000); + _bufferSize = (uint) random.Next(1, 1000); + _readBufferSize = (uint) random.Next(1, 1000); + _writeBufferSize = (uint) random.Next(1, 1000); } protected override void SetupMocks() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Closed_FileAccessRead.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Closed_FileAccessRead.cs index 932a88ab5..0105a780f 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Closed_FileAccessRead.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Closed_FileAccessRead.cs @@ -24,9 +24,9 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(1, random); - _bufferSize = (uint) random.Next(0, 1000); - _readBufferSize = (uint) random.Next(0, 1000); - _writeBufferSize = (uint) random.Next(0, 1000); + _bufferSize = (uint) random.Next(1, 1000); + _readBufferSize = (uint) random.Next(1, 1000); + _writeBufferSize = (uint) random.Next(1, 1000); } protected override void SetupMocks() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Closed_FileAccessReadWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Closed_FileAccessReadWrite.cs index 9253bd763..9dffd925c 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Closed_FileAccessReadWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Closed_FileAccessReadWrite.cs @@ -24,9 +24,9 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(1, random); - _bufferSize = (uint) random.Next(0, 1000); - _readBufferSize = (uint) random.Next(0, 1000); - _writeBufferSize = (uint) random.Next(0, 1000); + _bufferSize = (uint) random.Next(1, 1000); + _readBufferSize = (uint) random.Next(1, 1000); + _writeBufferSize = (uint) random.Next(1, 1000); } protected override void SetupMocks() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Closed_FileAccessWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Closed_FileAccessWrite.cs index 0b630d880..c51af38d2 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Closed_FileAccessWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Closed_FileAccessWrite.cs @@ -24,9 +24,9 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(1, random); - _bufferSize = (uint) random.Next(0, 1000); - _readBufferSize = (uint) random.Next(0, 1000); - _writeBufferSize = (uint) random.Next(0, 1000); + _bufferSize = (uint) random.Next(1, 1000); + _readBufferSize = (uint) random.Next(1, 1000); + _writeBufferSize = (uint) random.Next(1, 1000); } protected override void SetupMocks() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Disposed_FileAccessRead.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Disposed_FileAccessRead.cs index f13a072ec..8c0f4e143 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Disposed_FileAccessRead.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Disposed_FileAccessRead.cs @@ -24,9 +24,9 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(1, random); - _bufferSize = (uint) random.Next(0, 1000); - _readBufferSize = (uint) random.Next(0, 1000); - _writeBufferSize = (uint) random.Next(0, 1000); + _bufferSize = (uint) random.Next(1, 1000); + _readBufferSize = (uint) random.Next(1, 1000); + _writeBufferSize = (uint) random.Next(1, 1000); } protected override void SetupMocks() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Disposed_FileAccessReadWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Disposed_FileAccessReadWrite.cs index 0f70b8750..b669811dc 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Disposed_FileAccessReadWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Disposed_FileAccessReadWrite.cs @@ -24,9 +24,9 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(1, random); - _bufferSize = (uint) random.Next(0, 1000); - _readBufferSize = (uint) random.Next(0, 1000); - _writeBufferSize = (uint) random.Next(0, 1000); + _bufferSize = (uint) random.Next(1, 1000); + _readBufferSize = (uint) random.Next(1, 1000); + _writeBufferSize = (uint) random.Next(1, 1000); } protected override void SetupMocks() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Disposed_FileAccessWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Disposed_FileAccessWrite.cs index 4474cafdf..58238385b 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Disposed_FileAccessWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Disposed_FileAccessWrite.cs @@ -24,9 +24,9 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(1, random); - _bufferSize = (uint) random.Next(0, 1000); - _readBufferSize = (uint) random.Next(0, 1000); - _writeBufferSize = (uint) random.Next(0, 1000); + _bufferSize = (uint) random.Next(1, 1000); + _readBufferSize = (uint) random.Next(1, 1000); + _writeBufferSize = (uint) random.Next(1, 1000); } protected override void SetupMocks() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Close_Disposed.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Close_Disposed.cs index 59a6357b5..ee7d6548f 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Close_Disposed.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Close_Disposed.cs @@ -24,8 +24,8 @@ protected override void SetupData() _path = random.Next().ToString(); _handle = GenerateRandom(2, random); _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(0, 1000); - _writeBufferSize = (uint) random.Next(0, 1000); + _readBufferSize = (uint) random.Next(1, 1000); + _writeBufferSize = (uint) random.Next(1, 1000); } protected override void SetupMocks() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Close_SessionNotOpen.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Close_SessionNotOpen.cs index 0d3dc1b22..2d4c6e424 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Close_SessionNotOpen.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Close_SessionNotOpen.cs @@ -24,8 +24,8 @@ protected override void SetupData() _path = random.Next().ToString(); _handle = GenerateRandom(2, random); _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(0, 1000); - _writeBufferSize = (uint) random.Next(0, 1000); + _readBufferSize = (uint) random.Next(1, 1000); + _writeBufferSize = (uint) random.Next(1, 1000); } protected override void SetupMocks() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Close_SessionOpen.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Close_SessionOpen.cs index 8ad19bce6..ce7a09a2d 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Close_SessionOpen.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Close_SessionOpen.cs @@ -27,8 +27,8 @@ protected override void SetupData() _path = random.Next().ToString(); _handle = GenerateRandom(2, random); _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(0, 1000); - _writeBufferSize = (uint) random.Next(0, 1000); + _readBufferSize = (uint) random.Next(1, 1000); + _writeBufferSize = (uint) random.Next(1, 1000); } protected override void SetupMocks() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Dispose_Closed.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Dispose_Closed.cs index 0c6986242..b194338f1 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Dispose_Closed.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Dispose_Closed.cs @@ -27,8 +27,8 @@ protected override void SetupData() _path = random.Next().ToString(); _handle = GenerateRandom(random.Next(1, 5), random); _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(0, 1000); - _writeBufferSize = (uint) random.Next(0, 1000); + _readBufferSize = (uint) random.Next(1, 1000); + _writeBufferSize = (uint) random.Next(1, 1000); } protected override void SetupMocks() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Dispose_Disposed.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Dispose_Disposed.cs index 2fccf0483..31b3e0962 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Dispose_Disposed.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Dispose_Disposed.cs @@ -24,8 +24,8 @@ protected override void SetupData() _path = random.Next().ToString(); _handle = GenerateRandom(1, random); _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(0, 1000); - _writeBufferSize = (uint) random.Next(0, 1000); + _readBufferSize = (uint) random.Next(1, 1000); + _writeBufferSize = (uint) random.Next(1, 1000); } protected override void SetupMocks() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Dispose_SessionNotOpen.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Dispose_SessionNotOpen.cs index e1aae67bc..27858090c 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Dispose_SessionNotOpen.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Dispose_SessionNotOpen.cs @@ -27,8 +27,8 @@ protected override void SetupData() _path = random.Next().ToString(); _handle = GenerateRandom(2, random); _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(0, 1000); - _writeBufferSize = (uint) random.Next(0, 1000); + _readBufferSize = (uint) random.Next(1, 1000); + _writeBufferSize = (uint) random.Next(1, 1000); } protected override void SetupMocks() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Dispose_SessionOpen.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Dispose_SessionOpen.cs index 9429579f0..09fec553a 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Dispose_SessionOpen.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Dispose_SessionOpen.cs @@ -28,8 +28,8 @@ protected override void SetupData() _path = random.Next().ToString(CultureInfo.InvariantCulture); _handle = GenerateRandom(2, random); _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(0, 1000); - _writeBufferSize = (uint) random.Next(0, 1000); + _readBufferSize = (uint) random.Next(1, 1000); + _writeBufferSize = (uint) random.Next(1, 1000); } protected override void SetupMocks() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Finalize_SessionOpen.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Finalize_SessionOpen.cs index 7ea748873..1d55e17f4 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Finalize_SessionOpen.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Finalize_SessionOpen.cs @@ -25,8 +25,8 @@ protected override void SetupData() _path = random.Next().ToString(CultureInfo.InvariantCulture); _handle = GenerateRandom(7, random); _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(0, 1000); - _writeBufferSize = (uint) random.Next(0, 1000); + _readBufferSize = (uint) random.Next(1, 1000); + _writeBufferSize = (uint) random.Next(1, 1000); } protected override void SetupMocks() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadByte_ReadMode_NoDataInWriteBufferAndNoDataInReadBuffer_Eof.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadByte_ReadMode_NoDataInWriteBufferAndNoDataInReadBuffer_Eof.cs index 75da00bd7..d3bd505a8 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadByte_ReadMode_NoDataInWriteBufferAndNoDataInReadBuffer_Eof.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadByte_ReadMode_NoDataInWriteBufferAndNoDataInReadBuffer_Eof.cs @@ -25,8 +25,8 @@ protected override void SetupData() _path = random.Next().ToString(); _handle = GenerateRandom(1, random); _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(0, 1000); - _writeBufferSize = (uint) random.Next(0, 1000); + _readBufferSize = (uint) random.Next(1, 1000); + _writeBufferSize = (uint) random.Next(1, 1000); } protected override void SetupMocks() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_Disposed.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_Disposed.cs index e49cda8ff..22db2ac45 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_Disposed.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_Disposed.cs @@ -31,8 +31,8 @@ protected void Arrange() _path = random.Next().ToString(); _handle = new[] {(byte) random.Next(byte.MinValue, byte.MaxValue)}; _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(0, 1000); - _writeBufferSize = (uint) random.Next(0, 1000); + _readBufferSize = (uint) random.Next(1, 1000); + _writeBufferSize = (uint) random.Next(1, 1000); _sftpSessionMock = new Mock(MockBehavior.Strict); diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionNotOpen.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionNotOpen.cs index 8304db053..a7e707653 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionNotOpen.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionNotOpen.cs @@ -26,8 +26,8 @@ protected override void SetupData() _path = random.Next().ToString(); _handle = GenerateRandom(4, random); _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(0, 1000); - _writeBufferSize = (uint) random.Next(0, 1000); + _readBufferSize = (uint) random.Next(1, 1000); + _writeBufferSize = (uint) random.Next(1, 1000); _length = random.Next(); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FIleAccessRead.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FIleAccessRead.cs index 047beb1eb..e93017f53 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FIleAccessRead.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FIleAccessRead.cs @@ -26,8 +26,8 @@ protected override void SetupData() _path = random.Next().ToString(); _handle = GenerateRandom(5, random); _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(0, 1000); - _writeBufferSize = (uint) random.Next(0, 1000); + _readBufferSize = (uint) random.Next(1, 1000); + _writeBufferSize = (uint) random.Next(1, 1000); _length = random.Next(); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FIleAccessReadWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FIleAccessReadWrite.cs index ef89483b3..f18711762 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FIleAccessReadWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FIleAccessReadWrite.cs @@ -44,8 +44,8 @@ protected void Arrange() _path = random.Next().ToString(CultureInfo.InvariantCulture); _handle = new[] {(byte) random.Next(byte.MinValue, byte.MaxValue)}; _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(0, 1000); - _writeBufferSize = (uint) random.Next(0, 1000); + _readBufferSize = (uint) random.Next(1, 1000); + _writeBufferSize = (uint) random.Next(1, 1000); _length = random.Next(); _fileAttributesLastAccessTime = DateTime.UtcNow.AddSeconds(random.Next()); diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FIleAccessWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FIleAccessWrite.cs index 73b5a9536..d741ad1fd 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FIleAccessWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FIleAccessWrite.cs @@ -44,8 +44,8 @@ protected void Arrange() _path = random.Next().ToString(CultureInfo.InvariantCulture); _handle = new[] {(byte) random.Next(byte.MinValue, byte.MaxValue)}; _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(0, 1000); - _writeBufferSize = (uint) random.Next(0, 1000); + _readBufferSize = (uint) random.Next(1, 1000); + _writeBufferSize = (uint) random.Next(1, 1000); _length = random.Next(); _fileAttributesLastAccessTime = DateTime.UtcNow.AddSeconds(random.Next());