Rename (I)SftpMessageFactory to (I)SftpResponseFactory.

This commit is contained in:
Gert Driesen
2017-08-06 20:11:09 +02:00
parent e2cf28a28d
commit b548622524
17 changed files with 71 additions and 64 deletions
@@ -743,6 +743,9 @@
<Compile Include="..\Renci.SshNet\Sftp\ISftpFileReader.cs">
<Link>Sftp\ISftpFileReader.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\ISftpResponseFactory.cs">
<Link>Sftp\ISftpResponseFactory.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\ISftpSession.cs">
<Link>Sftp\ISftpSession.cs</Link>
</Compile>
@@ -899,6 +902,9 @@
<Compile Include="..\Renci.SshNet\Sftp\SftpRealPathAsyncResult.cs">
<Link>Sftp\SftpRealPathAsyncResult.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\SftpResponseFactory.cs">
<Link>Sftp\SftpResponseFactory.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\SftpSession.cs">
<Link>Sftp\SftpSession.cs</Link>
</Compile>
@@ -947,7 +953,7 @@
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
<UserProperties ProjectLinkerExcludeFilter="\\?desktop(\\.*)?$;\\?silverlight(\\.*)?$;\.desktop;\.silverlight;\.xaml;^service references(\\.*)?$;\.clientconfig;^web references(\\.*)?$" ProjectLinkReference="2f5f8c90-0bd1-424f-997c-7bc6280919d1" />
<UserProperties ProjectLinkReference="2f5f8c90-0bd1-424f-997c-7bc6280919d1" ProjectLinkerExcludeFilter="\\?desktop(\\.*)?$;\\?silverlight(\\.*)?$;\.desktop;\.silverlight;\.xaml;^service references(\\.*)?$;\.clientconfig;^web references(\\.*)?$" />
</VisualStudio>
</ProjectExtensions>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
@@ -18,7 +18,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp
private Mock<ISession> _sessionMock;
private Mock<IChannelSession> _channelSessionMock;
private ISftpResponseFactory _sftpMessageFactory;
private ISftpResponseFactory _sftpResponseFactory;
private SftpSession _sftpSession;
private int _operationTimeout;
private Encoding _encoding;
@@ -54,7 +54,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp
_operationTimeout = random.Next(100, 500);
_protocolVersion = (uint) random.Next(0, 3);
_encoding = Encoding.UTF8;
_sftpMessageFactory = new SftpResponseFactory();
_sftpResponseFactory = new SftpResponseFactory();
_sftpInitRequestBytes = new SftpInitRequestBuilder().WithVersion(SftpSession.MaximumSupportedVersion)
.Build()
.GetBytes();
@@ -144,7 +144,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp
CreateMocks();
SetupMocks();
_sftpSession = new SftpSession(_sessionMock.Object, _operationTimeout, _encoding, _sftpMessageFactory);
_sftpSession = new SftpSession(_sessionMock.Object, _operationTimeout, _encoding, _sftpResponseFactory);
_sftpSession.Connect();
}
@@ -16,7 +16,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp
private Mock<ISession> _sessionMock;
private Mock<IChannelSession> _channelSessionMock;
private ISftpResponseFactory _sftpMessageFactory;
private ISftpResponseFactory _sftpResponseFactory;
private SftpSession _sftpSession;
private int _operationTimeout;
private Encoding _encoding;
@@ -50,7 +50,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp
_operationTimeout = random.Next(100, 500);
_encoding = Encoding.UTF8;
_protocolVersion = 3;
_sftpMessageFactory = new SftpResponseFactory();
_sftpResponseFactory = new SftpResponseFactory();
_sftpInitRequestBytes = new SftpInitRequestBuilder().WithVersion(SftpSession.MaximumSupportedVersion)
.Build()
.GetBytes();
@@ -132,7 +132,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp
CreateMocks();
SetupMocks();
_sftpSession = new SftpSession(_sessionMock.Object, _operationTimeout, _encoding, _sftpMessageFactory);
_sftpSession = new SftpSession(_sessionMock.Object, _operationTimeout, _encoding, _sftpResponseFactory);
_sftpSession.Connect();
}
@@ -17,7 +17,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp
private Mock<ISession> _sessionMock;
private Mock<IChannelSession> _channelSessionMock;
private Mock<ISftpResponseFactory> _sftpMessageFactoryMock;
private Mock<ISftpResponseFactory> _sftpResponseFactoryMock;
private SftpSession _sftpSession;
private int _operationTimeout;
private Encoding _encoding;
@@ -111,7 +111,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp
{
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
_channelSessionMock = new Mock<IChannelSession>(MockBehavior.Strict);
_sftpMessageFactoryMock = new Mock<ISftpResponseFactory>(MockBehavior.Strict);
_sftpResponseFactoryMock = new Mock<ISftpResponseFactory>(MockBehavior.Strict);
}
private void SetupMocks()
@@ -130,7 +130,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp
_channelSessionMock.Raise(c => c.DataReceived += null,
new ChannelDataEventArgs(0, _sftpVersionResponse.GetBytes()));
});
_sftpMessageFactoryMock.InSequence(sequence)
_sftpResponseFactoryMock.InSequence(sequence)
.Setup(p => p.Create(0U, (byte)SftpMessageTypes.Version, _encoding))
.Returns(_sftpVersionResponse);
_channelSessionMock.InSequence(sequence).Setup(p => p.IsOpen).Returns(true);
@@ -140,7 +140,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp
_channelSessionMock.Raise(c => c.DataReceived += null,
new ChannelDataEventArgs(0, _sftpNameResponse.GetBytes()));
});
_sftpMessageFactoryMock.InSequence(sequence)
_sftpResponseFactoryMock.InSequence(sequence)
.Setup(p => p.Create(_protocolVersion, (byte)SftpMessageTypes.Name, _encoding))
.Returns(_sftpNameResponse);
@@ -158,10 +158,10 @@ namespace Renci.SshNet.Tests.Classes.Sftp
_channelSessionMock.Raise(c => c.DataReceived += null,
new ChannelDataEventArgs(0, sshMessagePayload));
});
_sftpMessageFactoryMock.InSequence(sequence)
_sftpResponseFactoryMock.InSequence(sequence)
.Setup(p => p.Create(_protocolVersion, (byte) SftpMessageTypes.Handle, _encoding))
.Returns(new SftpHandleResponse(_protocolVersion));
_sftpMessageFactoryMock.InSequence(sequence)
_sftpResponseFactoryMock.InSequence(sequence)
.Setup(p => p.Create(_protocolVersion, (byte) SftpMessageTypes.Data, _encoding))
.Returns(new SftpDataResponse(_protocolVersion));
}
@@ -172,7 +172,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp
CreateMocks();
SetupMocks();
_sftpSession = new SftpSession(_sessionMock.Object, _operationTimeout, _encoding, _sftpMessageFactoryMock.Object);
_sftpSession = new SftpSession(_sessionMock.Object, _operationTimeout, _encoding, _sftpResponseFactoryMock.Object);
_sftpSession.Connect();
}
@@ -17,7 +17,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp
private Mock<ISession> _sessionMock;
private Mock<IChannelSession> _channelSessionMock;
private Mock<ISftpResponseFactory> _sftpMessageFactoryMock;
private Mock<ISftpResponseFactory> _sftpResponseFactoryMock;
private SftpSession _sftpSession;
private int _operationTimeout;
private Encoding _encoding;
@@ -111,7 +111,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp
{
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
_channelSessionMock = new Mock<IChannelSession>(MockBehavior.Strict);
_sftpMessageFactoryMock = new Mock<ISftpResponseFactory>(MockBehavior.Strict);
_sftpResponseFactoryMock = new Mock<ISftpResponseFactory>(MockBehavior.Strict);
}
private void SetupMocks()
@@ -130,7 +130,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp
_channelSessionMock.Raise(c => c.DataReceived += null,
new ChannelDataEventArgs(0, _sftpVersionResponse.GetBytes()));
});
_sftpMessageFactoryMock.InSequence(sequence)
_sftpResponseFactoryMock.InSequence(sequence)
.Setup(p => p.Create(0U, (byte)SftpMessageTypes.Version, _encoding))
.Returns(_sftpVersionResponse);
_channelSessionMock.InSequence(sequence).Setup(p => p.IsOpen).Returns(true);
@@ -140,7 +140,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp
_channelSessionMock.Raise(c => c.DataReceived += null,
new ChannelDataEventArgs(0, _sftpNameResponse.GetBytes()));
});
_sftpMessageFactoryMock.InSequence(sequence)
_sftpResponseFactoryMock.InSequence(sequence)
.Setup(p => p.Create(_protocolVersion, (byte)SftpMessageTypes.Name, _encoding))
.Returns(_sftpNameResponse);
@@ -156,7 +156,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp
_channelSessionMock.Raise(c => c.DataReceived += null,
new ChannelDataEventArgs(0, sshMessagePayload));
});
_sftpMessageFactoryMock.InSequence(sequence)
_sftpResponseFactoryMock.InSequence(sequence)
.Setup(p => p.Create(_protocolVersion, (byte) SftpMessageTypes.Handle, _encoding))
.Returns(new SftpHandleResponse(_protocolVersion));
_channelSessionMock.InSequence(sequence).Setup(p => p.IsOpen).Returns(true);
@@ -168,7 +168,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp
_channelSessionMock.Raise(c => c.DataReceived += null,
new ChannelDataEventArgs(0, sshMessagePayload));
});
_sftpMessageFactoryMock.InSequence(sequence)
_sftpResponseFactoryMock.InSequence(sequence)
.Setup(p => p.Create(_protocolVersion, (byte) SftpMessageTypes.Data, _encoding))
.Returns(new SftpDataResponse(_protocolVersion));
}
@@ -179,7 +179,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp
CreateMocks();
SetupMocks();
_sftpSession = new SftpSession(_sessionMock.Object, _operationTimeout, _encoding, _sftpMessageFactoryMock.Object);
_sftpSession = new SftpSession(_sessionMock.Object, _operationTimeout, _encoding, _sftpResponseFactoryMock.Object);
_sftpSession.Connect();
}
@@ -17,7 +17,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp
private Mock<ISession> _sessionMock;
private Mock<IChannelSession> _channelSessionMock;
private Mock<ISftpResponseFactory> _sftpMessageFactoryMock;
private Mock<ISftpResponseFactory> _sftpResponseFactoryMock;
private SftpSession _sftpSession;
private int _operationTimeout;
private Encoding _encoding;
@@ -94,7 +94,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp
{
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
_channelSessionMock = new Mock<IChannelSession>(MockBehavior.Strict);
_sftpMessageFactoryMock = new Mock<ISftpResponseFactory>(MockBehavior.Strict);
_sftpResponseFactoryMock = new Mock<ISftpResponseFactory>(MockBehavior.Strict);
}
private void SetupMocks()
@@ -113,7 +113,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp
_channelSessionMock.Raise(c => c.DataReceived += null,
new ChannelDataEventArgs(0, _sftpVersionResponse.GetBytes()));
});
_sftpMessageFactoryMock.InSequence(sequence)
_sftpResponseFactoryMock.InSequence(sequence)
.Setup(p => p.Create(0U, (byte) SftpMessageTypes.Version, _encoding))
.Returns(_sftpVersionResponse);
_channelSessionMock.InSequence(sequence).Setup(p => p.IsOpen).Returns(true);
@@ -123,7 +123,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp
_channelSessionMock.Raise(c => c.DataReceived += null,
new ChannelDataEventArgs(0, _sftpNameResponse.GetBytes()));
});
_sftpMessageFactoryMock.InSequence(sequence)
_sftpResponseFactoryMock.InSequence(sequence)
.Setup(p => p.Create(_protocolVersion, (byte) SftpMessageTypes.Name, _encoding))
.Returns(_sftpNameResponse);
@@ -136,7 +136,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp
_channelSessionMock.Raise(c => c.DataReceived += null,
new ChannelDataEventArgs(0, _sftpDataResponseBytes));
});
_sftpMessageFactoryMock.InSequence(sequence)
_sftpResponseFactoryMock.InSequence(sequence)
.Setup(p => p.Create(_protocolVersion, (byte) SftpMessageTypes.Data, _encoding))
.Returns(new SftpDataResponse(_protocolVersion));
}
@@ -147,7 +147,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp
CreateMocks();
SetupMocks();
_sftpSession = new SftpSession(_sessionMock.Object, _operationTimeout, _encoding, _sftpMessageFactoryMock.Object);
_sftpSession = new SftpSession(_sessionMock.Object, _operationTimeout, _encoding, _sftpResponseFactoryMock.Object);
_sftpSession.Connect();
}
@@ -10,7 +10,7 @@ namespace Renci.SshNet.Tests.Classes
{
private Mock<IServiceFactory> _serviceFactoryMock;
private Mock<ISession> _sessionMock;
private Mock<ISftpResponseFactory> _sftpMessageFactoryMock;
private Mock<ISftpResponseFactory> _sftpResponseFactoryMock;
private Mock<ISftpSession> _sftpSessionMock;
private SftpClient _sftpClient;
private ConnectionInfo _connectionInfo;
@@ -32,7 +32,7 @@ namespace Renci.SshNet.Tests.Classes
{
_serviceFactoryMock = new Mock<IServiceFactory>(MockBehavior.Strict);
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
_sftpMessageFactoryMock = new Mock<ISftpResponseFactory>(MockBehavior.Strict);
_sftpResponseFactoryMock = new Mock<ISftpResponseFactory>(MockBehavior.Strict);
_sftpSessionMock = new Mock<ISftpSession>(MockBehavior.Strict);
_connectionInfo = new ConnectionInfo("host", "user", new NoneAuthenticationMethod("userauth"));
@@ -46,10 +46,10 @@ namespace Renci.SshNet.Tests.Classes
.Returns(_sessionMock.Object);
_sessionMock.InSequence(sequence).Setup(p => p.Connect());
_serviceFactoryMock.InSequence(sequence)
.Setup(p => p.CreateSftpMessageFactory())
.Returns(_sftpMessageFactoryMock.Object);
.Setup(p => p.CreateSftpResponseFactory())
.Returns(_sftpResponseFactoryMock.Object);
_serviceFactoryMock.InSequence(sequence)
.Setup(p => p.CreateSftpSession(_sessionMock.Object, _operationTimeout, _connectionInfo.Encoding, _sftpMessageFactoryMock.Object))
.Setup(p => p.CreateSftpSession(_sessionMock.Object, _operationTimeout, _connectionInfo.Encoding, _sftpResponseFactoryMock.Object))
.Returns(_sftpSessionMock.Object);
_sftpSessionMock.InSequence(sequence).Setup(p => p.Connect());
_sessionMock.InSequence(sequence).Setup(p => p.OnDisconnecting());
@@ -67,14 +67,14 @@ namespace Renci.SshNet.Tests.Classes
[TestMethod]
public void CreateSftpMessageFactoryOnServiceFactoryShouldBeInvokedOnce()
{
_serviceFactoryMock.Verify(p => p.CreateSftpMessageFactory(), Times.Once);
_serviceFactoryMock.Verify(p => p.CreateSftpResponseFactory(), Times.Once);
}
[TestMethod]
public void CreateSftpSessionOnServiceFactoryShouldBeInvokedOnce()
{
_serviceFactoryMock.Verify(
p => p.CreateSftpSession(_sessionMock.Object, _operationTimeout, _connectionInfo.Encoding, _sftpMessageFactoryMock.Object),
p => p.CreateSftpSession(_sessionMock.Object, _operationTimeout, _connectionInfo.Encoding, _sftpResponseFactoryMock.Object),
Times.Once);
}
@@ -10,7 +10,7 @@ namespace Renci.SshNet.Tests.Classes
{
private Mock<IServiceFactory> _serviceFactoryMock;
private Mock<ISession> _sessionMock;
private Mock<ISftpResponseFactory> _sftpMessageFactoryMock;
private Mock<ISftpResponseFactory> _sftpResponseFactoryMock;
private Mock<ISftpSession> _sftpSessionMock;
private SftpClient _sftpClient;
private ConnectionInfo _connectionInfo;
@@ -28,7 +28,7 @@ namespace Renci.SshNet.Tests.Classes
{
_serviceFactoryMock = new Mock<IServiceFactory>(MockBehavior.Strict);
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
_sftpMessageFactoryMock = new Mock<ISftpResponseFactory>(MockBehavior.Strict);
_sftpResponseFactoryMock = new Mock<ISftpResponseFactory>(MockBehavior.Strict);
_sftpSessionMock = new Mock<ISftpSession>(MockBehavior.Strict);
_connectionInfo = new ConnectionInfo("host", "user", new NoneAuthenticationMethod("userauth"));
@@ -42,10 +42,10 @@ namespace Renci.SshNet.Tests.Classes
.Returns(_sessionMock.Object);
_sessionMock.InSequence(sequence).Setup(p => p.Connect());
_serviceFactoryMock.InSequence(sequence)
.Setup(p => p.CreateSftpMessageFactory())
.Returns(_sftpMessageFactoryMock.Object);
.Setup(p => p.CreateSftpResponseFactory())
.Returns(_sftpResponseFactoryMock.Object);
_serviceFactoryMock.InSequence(sequence)
.Setup(p => p.CreateSftpSession(_sessionMock.Object, _operationTimeout, _connectionInfo.Encoding, _sftpMessageFactoryMock.Object))
.Setup(p => p.CreateSftpSession(_sessionMock.Object, _operationTimeout, _connectionInfo.Encoding, _sftpResponseFactoryMock.Object))
.Returns(_sftpSessionMock.Object);
_sftpSessionMock.InSequence(sequence).Setup(p => p.Connect());
_sessionMock.InSequence(sequence).Setup(p => p.OnDisconnecting());
@@ -64,14 +64,14 @@ namespace Renci.SshNet.Tests.Classes
[TestMethod]
public void CreateSftpMessageFactoryOnServiceFactoryShouldBeInvokedOnce()
{
_serviceFactoryMock.Verify(p => p.CreateSftpMessageFactory(), Times.Once);
_serviceFactoryMock.Verify(p => p.CreateSftpResponseFactory(), Times.Once);
}
[TestMethod]
public void CreateSftpSessionOnServiceFactoryShouldBeInvokedOnce()
{
_serviceFactoryMock.Verify(
p => p.CreateSftpSession(_sessionMock.Object, _operationTimeout, _connectionInfo.Encoding, _sftpMessageFactoryMock.Object),
p => p.CreateSftpSession(_sessionMock.Object, _operationTimeout, _connectionInfo.Encoding, _sftpResponseFactoryMock.Object),
Times.Once);
}
@@ -10,7 +10,7 @@ namespace Renci.SshNet.Tests.Classes
{
private Mock<IServiceFactory> _serviceFactoryMock;
private Mock<ISession> _sessionMock;
private Mock<ISftpResponseFactory> _sftpMessageFactoryMock;
private Mock<ISftpResponseFactory> _sftpResponseFactoryMock;
private Mock<ISftpSession> _sftpSessionMock;
private SftpClient _sftpClient;
private ConnectionInfo _connectionInfo;
@@ -32,7 +32,7 @@ namespace Renci.SshNet.Tests.Classes
{
_serviceFactoryMock = new Mock<IServiceFactory>(MockBehavior.Strict);
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
_sftpMessageFactoryMock = new Mock<ISftpResponseFactory>(MockBehavior.Strict);
_sftpResponseFactoryMock = new Mock<ISftpResponseFactory>(MockBehavior.Strict);
_sftpSessionMock = new Mock<ISftpSession>(MockBehavior.Strict);
_connectionInfo = new ConnectionInfo("host", "user", new NoneAuthenticationMethod("userauth"));
@@ -46,10 +46,10 @@ namespace Renci.SshNet.Tests.Classes
.Returns(_sessionMock.Object);
_sessionMock.InSequence(sequence).Setup(p => p.Connect());
_serviceFactoryMock.InSequence(sequence)
.Setup(p => p.CreateSftpMessageFactory())
.Returns(_sftpMessageFactoryMock.Object);
.Setup(p => p.CreateSftpResponseFactory())
.Returns(_sftpResponseFactoryMock.Object);
_serviceFactoryMock.InSequence(sequence)
.Setup(p => p.CreateSftpSession(_sessionMock.Object, _operationTimeout, _connectionInfo.Encoding, _sftpMessageFactoryMock.Object))
.Setup(p => p.CreateSftpSession(_sessionMock.Object, _operationTimeout, _connectionInfo.Encoding, _sftpResponseFactoryMock.Object))
.Returns(_sftpSessionMock.Object);
_sftpSessionMock.InSequence(sequence).Setup(p => p.Connect());
_sessionMock.InSequence(sequence).Setup(p => p.OnDisconnecting());
@@ -68,14 +68,14 @@ namespace Renci.SshNet.Tests.Classes
[TestMethod]
public void CreateSftpMessageFactoryOnServiceFactoryShouldBeInvokedOnce()
{
_serviceFactoryMock.Verify(p => p.CreateSftpMessageFactory(), Times.Once);
_serviceFactoryMock.Verify(p => p.CreateSftpResponseFactory(), Times.Once);
}
[TestMethod]
public void CreateSftpSessionOnServiceFactoryShouldBeInvokedOnce()
{
_serviceFactoryMock.Verify(
p => p.CreateSftpSession(_sessionMock.Object, _operationTimeout, _connectionInfo.Encoding, _sftpMessageFactoryMock.Object),
p => p.CreateSftpSession(_sessionMock.Object, _operationTimeout, _connectionInfo.Encoding, _sftpResponseFactoryMock.Object),
Times.Once);
}
@@ -10,7 +10,7 @@ namespace Renci.SshNet.Tests.Classes
{
private Mock<IServiceFactory> _serviceFactoryMock;
private Mock<ISession> _sessionMock;
private Mock<ISftpResponseFactory> _sftpMessageFactoryMock;
private Mock<ISftpResponseFactory> _sftpResponseFactoryMock;
private Mock<ISftpSession> _sftpSessionMock;
private SftpClient _sftpClient;
private ConnectionInfo _connectionInfo;
@@ -27,7 +27,7 @@ namespace Renci.SshNet.Tests.Classes
{
_serviceFactoryMock = new Mock<IServiceFactory>(MockBehavior.Loose);
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
_sftpMessageFactoryMock = new Mock<ISftpResponseFactory>(MockBehavior.Strict);
_sftpResponseFactoryMock = new Mock<ISftpResponseFactory>(MockBehavior.Strict);
_sftpSessionMock = new Mock<ISftpSession>(MockBehavior.Strict);
_connectionInfo = new ConnectionInfo("host", "user", new NoneAuthenticationMethod("userauth"));
@@ -38,9 +38,9 @@ namespace Renci.SshNet.Tests.Classes
_serviceFactoryMock.Setup(p => p.CreateSession(_connectionInfo))
.Returns(_sessionMock.Object);
_sessionMock.Setup(p => p.Connect());
_serviceFactoryMock.Setup(p => p.CreateSftpMessageFactory())
.Returns(_sftpMessageFactoryMock.Object);
_serviceFactoryMock.Setup(p => p.CreateSftpSession(_sessionMock.Object, _operationTimeout, _connectionInfo.Encoding, _sftpMessageFactoryMock.Object))
_serviceFactoryMock.Setup(p => p.CreateSftpResponseFactory())
.Returns(_sftpResponseFactoryMock.Object);
_serviceFactoryMock.Setup(p => p.CreateSftpSession(_sessionMock.Object, _operationTimeout, _connectionInfo.Encoding, _sftpResponseFactoryMock.Object))
.Returns(_sftpSessionMock.Object);
_sftpSessionMock.Setup(p => p.Connect());
+1 -1
View File
@@ -61,6 +61,6 @@ namespace Renci.SshNet
ISftpFileReader CreateSftpFileReader(string fileName, ISftpSession sftpSession, uint bufferSize);
ISftpResponseFactory CreateSftpMessageFactory();
ISftpResponseFactory CreateSftpResponseFactory();
}
}
+2 -2
View File
@@ -172,7 +172,7 @@
<Compile Include="ServiceFactory.cs" />
<Compile Include="ServiceFactory.NET.cs" />
<Compile Include="Sftp\ISftpFileReader.cs" />
<Compile Include="Sftp\ISftpMessageFactory.cs" />
<Compile Include="Sftp\ISftpResponseFactory.cs" />
<Compile Include="Sftp\ISftpSession.cs" />
<Compile Include="Common\SshDataStream.cs" />
<Compile Include="ExpectAsyncResult.cs" />
@@ -429,7 +429,7 @@
</Compile>
<Compile Include="Sftp\SftpListDirectoryAsyncResult.cs" />
<Compile Include="Sftp\SftpMessage.cs" />
<Compile Include="Sftp\SftpMessageFactory.cs" />
<Compile Include="Sftp\SftpResponseFactory.cs" />
<Compile Include="Sftp\SftpMessageTypes.cs">
<SubType>Code</SubType>
</Compile>
+1 -1
View File
@@ -132,7 +132,7 @@ namespace Renci.SshNet
return sftpSession.CreateFileReader(handle, sftpSession, chunkSize, maxPendingReads, fileSize);
}
public ISftpResponseFactory CreateSftpMessageFactory()
public ISftpResponseFactory CreateSftpResponseFactory()
{
return new SftpResponseFactory();
}
@@ -42,7 +42,5 @@ namespace Renci.SshNet.Sftp
return message;
}
public
}
}
+4 -4
View File
@@ -15,7 +15,7 @@ namespace Renci.SshNet.Sftp
private const int MinimumSupportedVersion = 0;
private readonly Dictionary<uint, SftpRequest> _requests = new Dictionary<uint, SftpRequest>();
private readonly ISftpResponseFactory _sftpMessageFactory;
private readonly ISftpResponseFactory _sftpResponseFactory;
//FIXME: obtain from SftpClient!
private readonly List<byte> _data = new List<byte>(32 * 1024);
private EventWaitHandle _sftpVersionConfirmed = new AutoResetEvent(false);
@@ -55,11 +55,11 @@ namespace Renci.SshNet.Sftp
}
}
public SftpSession(ISession session, int operationTimeout, Encoding encoding, ISftpResponseFactory sftpMessageFactory)
public SftpSession(ISession session, int operationTimeout, Encoding encoding, ISftpResponseFactory sftpResponseFactory)
: base(session, "sftp", operationTimeout)
{
Encoding = encoding;
_sftpMessageFactory = sftpMessageFactory;
_sftpResponseFactory = sftpResponseFactory;
}
/// <summary>
@@ -291,7 +291,7 @@ namespace Renci.SshNet.Sftp
private bool TryLoadSftpMessage(byte[] packetData, int offset, int count)
{
// Create SFTP message
var response = _sftpMessageFactory.Create(ProtocolVersion, packetData[offset], Encoding);
var response = _sftpResponseFactory.Create(ProtocolVersion, packetData[offset], Encoding);
// Load message data into it
response.Load(packetData, offset + 1, count - 1);
+4 -1
View File
@@ -2122,7 +2122,10 @@ namespace Renci.SshNet
{
base.OnConnected();
_sftpSession = ServiceFactory.CreateSftpSession(Session, _operationTimeout, ConnectionInfo.Encoding, ServiceFactory.CreateSftpMessageFactory());
_sftpSession = ServiceFactory.CreateSftpSession(Session,
_operationTimeout,
ConnectionInfo.Encoding,
ServiceFactory.CreateSftpResponseFactory());
_sftpSession.Connect();
}