mirror of
https://github.com/sshnet/SSH.NET.git
synced 2026-10-17 05:21:15 +08:00
Fix some test failures on .NET Core.
This commit is contained in:
+4
@@ -55,6 +55,10 @@ namespace Renci.SshNet.Tests.Classes
|
||||
.Returns(false);
|
||||
_channelSessionMock.InSequence(sequence).Setup(p => p.Dispose());
|
||||
_pipeStreamMock.As<IDisposable>().InSequence(sequence).Setup(p => p.Dispose());
|
||||
|
||||
// On .NET Core, Dispose() in turn invokes Close() and since we're not mocking
|
||||
// an interface, we need to expect this call as well
|
||||
_pipeStreamMock.Setup(p => p.Close());
|
||||
}
|
||||
|
||||
protected override void Arrange()
|
||||
|
||||
+4
@@ -54,6 +54,10 @@ namespace Renci.SshNet.Tests.Classes
|
||||
.Setup(p => p.SendExecRequest(string.Format("scp -pf {0}", _transformedPath))).Returns(false);
|
||||
_channelSessionMock.InSequence(sequence).Setup(p => p.Dispose());
|
||||
_pipeStreamMock.As<IDisposable>().InSequence(sequence).Setup(p => p.Dispose());
|
||||
|
||||
// On .NET Core, Dispose() in turn invokes Close() and since we're not mocking
|
||||
// an interface, we need to expect this call as well
|
||||
_pipeStreamMock.Setup(p => p.Close());
|
||||
}
|
||||
|
||||
protected override void Arrange()
|
||||
|
||||
+14
-9
@@ -19,15 +19,6 @@ namespace Renci.SshNet.Tests.Classes
|
||||
private IList<ScpUploadEventArgs> _uploadingRegister;
|
||||
private SshException _actualException;
|
||||
|
||||
[TestCleanup]
|
||||
public void Cleanup()
|
||||
{
|
||||
if (_destination != null)
|
||||
{
|
||||
_destination.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void SetupData()
|
||||
{
|
||||
var random = new Random();
|
||||
@@ -64,6 +55,10 @@ namespace Renci.SshNet.Tests.Classes
|
||||
.Returns(false);
|
||||
_channelSessionMock.InSequence(sequence).Setup(p => p.Dispose());
|
||||
_pipeStreamMock.As<IDisposable>().InSequence(sequence).Setup(p => p.Dispose());
|
||||
|
||||
// On .NET Core, Dispose() in turn invokes Close() and since we're not mocking
|
||||
// an interface, we need to expect this call as well
|
||||
_pipeStreamMock.Setup(p => p.Close());
|
||||
}
|
||||
|
||||
protected override void Arrange()
|
||||
@@ -75,6 +70,16 @@ namespace Renci.SshNet.Tests.Classes
|
||||
_scpClient.Connect();
|
||||
}
|
||||
|
||||
protected override void TearDown()
|
||||
{
|
||||
base.TearDown();
|
||||
|
||||
if (_destination != null)
|
||||
{
|
||||
_destination.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Act()
|
||||
{
|
||||
try
|
||||
|
||||
+4
@@ -54,6 +54,10 @@ namespace Renci.SshNet.Tests.Classes
|
||||
.Returns(false);
|
||||
_channelSessionMock.InSequence(sequence).Setup(p => p.Dispose());
|
||||
_pipeStreamMock.As<IDisposable>().InSequence(sequence).Setup(p => p.Dispose());
|
||||
|
||||
// On .NET Core, Dispose() in turn invokes Close() and since we're not mocking
|
||||
// an interface, we need to expect this call as well
|
||||
_pipeStreamMock.Setup(p => p.Close());
|
||||
}
|
||||
|
||||
protected override void Arrange()
|
||||
|
||||
+16
-11
@@ -21,16 +21,6 @@ namespace Renci.SshNet.Tests.Classes
|
||||
private IList<ScpUploadEventArgs> _uploadingRegister;
|
||||
private SshException _actualException;
|
||||
|
||||
[TestCleanup]
|
||||
public void Cleanup()
|
||||
{
|
||||
if (_fileName != null)
|
||||
{
|
||||
File.Delete(_fileName);
|
||||
_fileName = null;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void SetupData()
|
||||
{
|
||||
var random = new Random();
|
||||
@@ -70,7 +60,11 @@ namespace Renci.SshNet.Tests.Classes
|
||||
.Returns(false);
|
||||
_channelSessionMock.InSequence(sequence).Setup(p => p.Dispose());
|
||||
_pipeStreamMock.As<IDisposable>().InSequence(sequence).Setup(p => p.Dispose());
|
||||
}
|
||||
|
||||
// On .NET Core, Dispose() in turn invokes Close() and since we're not mocking
|
||||
// an interface, we need to expect this call as well
|
||||
_pipeStreamMock.Setup(p => p.Close());
|
||||
}
|
||||
|
||||
protected override void Arrange()
|
||||
{
|
||||
@@ -81,6 +75,17 @@ namespace Renci.SshNet.Tests.Classes
|
||||
_scpClient.Connect();
|
||||
}
|
||||
|
||||
protected override void TearDown()
|
||||
{
|
||||
base.TearDown();
|
||||
|
||||
if (_fileName != null)
|
||||
{
|
||||
File.Delete(_fileName);
|
||||
_fileName = null;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Act()
|
||||
{
|
||||
try
|
||||
|
||||
@@ -25,16 +25,6 @@ namespace Renci.SshNet.Tests.Classes
|
||||
private int _fileSize;
|
||||
private IList<ScpUploadEventArgs> _uploadingRegister;
|
||||
|
||||
[TestCleanup]
|
||||
public void Cleanup()
|
||||
{
|
||||
if (_fileName != null)
|
||||
{
|
||||
File.Delete(_fileName);
|
||||
_fileName = null;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void SetupData()
|
||||
{
|
||||
var random = new Random();
|
||||
@@ -95,6 +85,10 @@ namespace Renci.SshNet.Tests.Classes
|
||||
_pipeStreamMock.InSequence(sequence).Setup(p => p.ReadByte()).Returns(0);
|
||||
_channelSessionMock.InSequence(sequence).Setup(p => p.Dispose());
|
||||
_pipeStreamMock.As<IDisposable>().InSequence(sequence).Setup(p => p.Dispose());
|
||||
|
||||
// On .NET Core, Dispose() in turn invokes Close() and since we're not mocking
|
||||
// an interface, we need to expect this call as well
|
||||
_pipeStreamMock.Setup(p => p.Close());
|
||||
}
|
||||
|
||||
protected override void Arrange()
|
||||
@@ -109,6 +103,17 @@ namespace Renci.SshNet.Tests.Classes
|
||||
_scpClient.Connect();
|
||||
}
|
||||
|
||||
protected override void TearDown()
|
||||
{
|
||||
base.TearDown();
|
||||
|
||||
if (_fileName != null)
|
||||
{
|
||||
File.Delete(_fileName);
|
||||
_fileName = null;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Act()
|
||||
{
|
||||
_scpClient.Upload(_fileInfo, _remotePath);
|
||||
|
||||
+14
-9
@@ -20,15 +20,6 @@ namespace Renci.SshNet.Tests.Classes
|
||||
private IList<ScpUploadEventArgs> _uploadingRegister;
|
||||
private SshException _actualException;
|
||||
|
||||
[TestCleanup]
|
||||
public void Cleanup()
|
||||
{
|
||||
if (_source != null)
|
||||
{
|
||||
_source.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void SetupData()
|
||||
{
|
||||
var random = new Random();
|
||||
@@ -67,6 +58,10 @@ namespace Renci.SshNet.Tests.Classes
|
||||
.Returns(false);
|
||||
_channelSessionMock.InSequence(sequence).Setup(p => p.Dispose());
|
||||
_pipeStreamMock.As<IDisposable>().InSequence(sequence).Setup(p => p.Dispose());
|
||||
|
||||
// On .NET Core, Dispose() in turn invokes Close() and since we're not mocking
|
||||
// an interface, we need to expect this call as well
|
||||
_pipeStreamMock.Setup(p => p.Close());
|
||||
}
|
||||
|
||||
protected override void Arrange()
|
||||
@@ -78,6 +73,16 @@ namespace Renci.SshNet.Tests.Classes
|
||||
_scpClient.Connect();
|
||||
}
|
||||
|
||||
protected override void TearDown()
|
||||
{
|
||||
base.TearDown();
|
||||
|
||||
if (_source != null)
|
||||
{
|
||||
_source.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Act()
|
||||
{
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user