Skip to content

Commit b548622

Browse files
committed
Rename (I)SftpMessageFactory to (I)SftpResponseFactory.
1 parent e2cf28a commit b548622

17 files changed

+71
-64
lines changed

src/Renci.SshNet.NET35/Renci.SshNet.NET35.csproj

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,9 @@
743743
<Compile Include="..\Renci.SshNet\Sftp\ISftpFileReader.cs">
744744
<Link>Sftp\ISftpFileReader.cs</Link>
745745
</Compile>
746+
<Compile Include="..\Renci.SshNet\Sftp\ISftpResponseFactory.cs">
747+
<Link>Sftp\ISftpResponseFactory.cs</Link>
748+
</Compile>
746749
<Compile Include="..\Renci.SshNet\Sftp\ISftpSession.cs">
747750
<Link>Sftp\ISftpSession.cs</Link>
748751
</Compile>
@@ -899,6 +902,9 @@
899902
<Compile Include="..\Renci.SshNet\Sftp\SftpRealPathAsyncResult.cs">
900903
<Link>Sftp\SftpRealPathAsyncResult.cs</Link>
901904
</Compile>
905+
<Compile Include="..\Renci.SshNet\Sftp\SftpResponseFactory.cs">
906+
<Link>Sftp\SftpResponseFactory.cs</Link>
907+
</Compile>
902908
<Compile Include="..\Renci.SshNet\Sftp\SftpSession.cs">
903909
<Link>Sftp\SftpSession.cs</Link>
904910
</Compile>
@@ -947,7 +953,7 @@
947953
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
948954
<ProjectExtensions>
949955
<VisualStudio>
950-
<UserProperties ProjectLinkerExcludeFilter="\\?desktop(\\.*)?$;\\?silverlight(\\.*)?$;\.desktop;\.silverlight;\.xaml;^service references(\\.*)?$;\.clientconfig;^web references(\\.*)?$" ProjectLinkReference="2f5f8c90-0bd1-424f-997c-7bc6280919d1" />
956+
<UserProperties ProjectLinkReference="2f5f8c90-0bd1-424f-997c-7bc6280919d1" ProjectLinkerExcludeFilter="\\?desktop(\\.*)?$;\\?silverlight(\\.*)?$;\.desktop;\.silverlight;\.xaml;^service references(\\.*)?$;\.clientconfig;^web references(\\.*)?$" />
951957
</VisualStudio>
952958
</ProjectExtensions>
953959
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

src/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_Connected_RequestRead.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public class SftpSessionTest_Connected_RequestRead
1818

1919
private Mock<ISession> _sessionMock;
2020
private Mock<IChannelSession> _channelSessionMock;
21-
private ISftpResponseFactory _sftpMessageFactory;
21+
private ISftpResponseFactory _sftpResponseFactory;
2222
private SftpSession _sftpSession;
2323
private int _operationTimeout;
2424
private Encoding _encoding;
@@ -54,7 +54,7 @@ private void SetupData()
5454
_operationTimeout = random.Next(100, 500);
5555
_protocolVersion = (uint) random.Next(0, 3);
5656
_encoding = Encoding.UTF8;
57-
_sftpMessageFactory = new SftpResponseFactory();
57+
_sftpResponseFactory = new SftpResponseFactory();
5858
_sftpInitRequestBytes = new SftpInitRequestBuilder().WithVersion(SftpSession.MaximumSupportedVersion)
5959
.Build()
6060
.GetBytes();
@@ -144,7 +144,7 @@ private void Arrange()
144144
CreateMocks();
145145
SetupMocks();
146146

147-
_sftpSession = new SftpSession(_sessionMock.Object, _operationTimeout, _encoding, _sftpMessageFactory);
147+
_sftpSession = new SftpSession(_sessionMock.Object, _operationTimeout, _encoding, _sftpResponseFactory);
148148
_sftpSession.Connect();
149149
}
150150

src/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_Connected_RequestStatVfs.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class SftpSessionTest_Connected_RequestStatVfs
1616

1717
private Mock<ISession> _sessionMock;
1818
private Mock<IChannelSession> _channelSessionMock;
19-
private ISftpResponseFactory _sftpMessageFactory;
19+
private ISftpResponseFactory _sftpResponseFactory;
2020
private SftpSession _sftpSession;
2121
private int _operationTimeout;
2222
private Encoding _encoding;
@@ -50,7 +50,7 @@ private void SetupData()
5050
_operationTimeout = random.Next(100, 500);
5151
_encoding = Encoding.UTF8;
5252
_protocolVersion = 3;
53-
_sftpMessageFactory = new SftpResponseFactory();
53+
_sftpResponseFactory = new SftpResponseFactory();
5454
_sftpInitRequestBytes = new SftpInitRequestBuilder().WithVersion(SftpSession.MaximumSupportedVersion)
5555
.Build()
5656
.GetBytes();
@@ -132,7 +132,7 @@ protected void Arrange()
132132
CreateMocks();
133133
SetupMocks();
134134

135-
_sftpSession = new SftpSession(_sessionMock.Object, _operationTimeout, _encoding, _sftpMessageFactory);
135+
_sftpSession = new SftpSession(_sessionMock.Object, _operationTimeout, _encoding, _sftpResponseFactory);
136136
_sftpSession.Connect();
137137
}
138138

src/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_DataReceived_MultipleSftpMessagesInSingleSshDataMessage.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class SftpSessionTest_DataReceived_MultipleSftpMessagesInSingleSshDataMes
1717

1818
private Mock<ISession> _sessionMock;
1919
private Mock<IChannelSession> _channelSessionMock;
20-
private Mock<ISftpResponseFactory> _sftpMessageFactoryMock;
20+
private Mock<ISftpResponseFactory> _sftpResponseFactoryMock;
2121
private SftpSession _sftpSession;
2222
private int _operationTimeout;
2323
private Encoding _encoding;
@@ -111,7 +111,7 @@ private void CreateMocks()
111111
{
112112
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
113113
_channelSessionMock = new Mock<IChannelSession>(MockBehavior.Strict);
114-
_sftpMessageFactoryMock = new Mock<ISftpResponseFactory>(MockBehavior.Strict);
114+
_sftpResponseFactoryMock = new Mock<ISftpResponseFactory>(MockBehavior.Strict);
115115
}
116116

117117
private void SetupMocks()
@@ -130,7 +130,7 @@ private void SetupMocks()
130130
_channelSessionMock.Raise(c => c.DataReceived += null,
131131
new ChannelDataEventArgs(0, _sftpVersionResponse.GetBytes()));
132132
});
133-
_sftpMessageFactoryMock.InSequence(sequence)
133+
_sftpResponseFactoryMock.InSequence(sequence)
134134
.Setup(p => p.Create(0U, (byte)SftpMessageTypes.Version, _encoding))
135135
.Returns(_sftpVersionResponse);
136136
_channelSessionMock.InSequence(sequence).Setup(p => p.IsOpen).Returns(true);
@@ -140,7 +140,7 @@ private void SetupMocks()
140140
_channelSessionMock.Raise(c => c.DataReceived += null,
141141
new ChannelDataEventArgs(0, _sftpNameResponse.GetBytes()));
142142
});
143-
_sftpMessageFactoryMock.InSequence(sequence)
143+
_sftpResponseFactoryMock.InSequence(sequence)
144144
.Setup(p => p.Create(_protocolVersion, (byte)SftpMessageTypes.Name, _encoding))
145145
.Returns(_sftpNameResponse);
146146

@@ -158,10 +158,10 @@ private void SetupMocks()
158158
_channelSessionMock.Raise(c => c.DataReceived += null,
159159
new ChannelDataEventArgs(0, sshMessagePayload));
160160
});
161-
_sftpMessageFactoryMock.InSequence(sequence)
161+
_sftpResponseFactoryMock.InSequence(sequence)
162162
.Setup(p => p.Create(_protocolVersion, (byte) SftpMessageTypes.Handle, _encoding))
163163
.Returns(new SftpHandleResponse(_protocolVersion));
164-
_sftpMessageFactoryMock.InSequence(sequence)
164+
_sftpResponseFactoryMock.InSequence(sequence)
165165
.Setup(p => p.Create(_protocolVersion, (byte) SftpMessageTypes.Data, _encoding))
166166
.Returns(new SftpDataResponse(_protocolVersion));
167167
}
@@ -172,7 +172,7 @@ protected void Arrange()
172172
CreateMocks();
173173
SetupMocks();
174174

175-
_sftpSession = new SftpSession(_sessionMock.Object, _operationTimeout, _encoding, _sftpMessageFactoryMock.Object);
175+
_sftpSession = new SftpSession(_sessionMock.Object, _operationTimeout, _encoding, _sftpResponseFactoryMock.Object);
176176
_sftpSession.Connect();
177177
}
178178

src/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_DataReceived_MultipleSftpMessagesSplitOverMultipleSshDataMessages.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class SftpSessionTest_DataReceived_MultipleSftpMessagesSplitOverMultipleS
1717

1818
private Mock<ISession> _sessionMock;
1919
private Mock<IChannelSession> _channelSessionMock;
20-
private Mock<ISftpResponseFactory> _sftpMessageFactoryMock;
20+
private Mock<ISftpResponseFactory> _sftpResponseFactoryMock;
2121
private SftpSession _sftpSession;
2222
private int _operationTimeout;
2323
private Encoding _encoding;
@@ -111,7 +111,7 @@ private void CreateMocks()
111111
{
112112
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
113113
_channelSessionMock = new Mock<IChannelSession>(MockBehavior.Strict);
114-
_sftpMessageFactoryMock = new Mock<ISftpResponseFactory>(MockBehavior.Strict);
114+
_sftpResponseFactoryMock = new Mock<ISftpResponseFactory>(MockBehavior.Strict);
115115
}
116116

117117
private void SetupMocks()
@@ -130,7 +130,7 @@ private void SetupMocks()
130130
_channelSessionMock.Raise(c => c.DataReceived += null,
131131
new ChannelDataEventArgs(0, _sftpVersionResponse.GetBytes()));
132132
});
133-
_sftpMessageFactoryMock.InSequence(sequence)
133+
_sftpResponseFactoryMock.InSequence(sequence)
134134
.Setup(p => p.Create(0U, (byte)SftpMessageTypes.Version, _encoding))
135135
.Returns(_sftpVersionResponse);
136136
_channelSessionMock.InSequence(sequence).Setup(p => p.IsOpen).Returns(true);
@@ -140,7 +140,7 @@ private void SetupMocks()
140140
_channelSessionMock.Raise(c => c.DataReceived += null,
141141
new ChannelDataEventArgs(0, _sftpNameResponse.GetBytes()));
142142
});
143-
_sftpMessageFactoryMock.InSequence(sequence)
143+
_sftpResponseFactoryMock.InSequence(sequence)
144144
.Setup(p => p.Create(_protocolVersion, (byte)SftpMessageTypes.Name, _encoding))
145145
.Returns(_sftpNameResponse);
146146

@@ -156,7 +156,7 @@ private void SetupMocks()
156156
_channelSessionMock.Raise(c => c.DataReceived += null,
157157
new ChannelDataEventArgs(0, sshMessagePayload));
158158
});
159-
_sftpMessageFactoryMock.InSequence(sequence)
159+
_sftpResponseFactoryMock.InSequence(sequence)
160160
.Setup(p => p.Create(_protocolVersion, (byte) SftpMessageTypes.Handle, _encoding))
161161
.Returns(new SftpHandleResponse(_protocolVersion));
162162
_channelSessionMock.InSequence(sequence).Setup(p => p.IsOpen).Returns(true);
@@ -168,7 +168,7 @@ private void SetupMocks()
168168
_channelSessionMock.Raise(c => c.DataReceived += null,
169169
new ChannelDataEventArgs(0, sshMessagePayload));
170170
});
171-
_sftpMessageFactoryMock.InSequence(sequence)
171+
_sftpResponseFactoryMock.InSequence(sequence)
172172
.Setup(p => p.Create(_protocolVersion, (byte) SftpMessageTypes.Data, _encoding))
173173
.Returns(new SftpDataResponse(_protocolVersion));
174174
}
@@ -179,7 +179,7 @@ protected void Arrange()
179179
CreateMocks();
180180
SetupMocks();
181181

182-
_sftpSession = new SftpSession(_sessionMock.Object, _operationTimeout, _encoding, _sftpMessageFactoryMock.Object);
182+
_sftpSession = new SftpSession(_sessionMock.Object, _operationTimeout, _encoding, _sftpResponseFactoryMock.Object);
183183
_sftpSession.Connect();
184184
}
185185

src/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_DataReceived_SingleSftpMessageInSshDataMessage.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public class SftpSessionTest_DataReceived_SingleSftpMessageInSshDataMessage
1717

1818
private Mock<ISession> _sessionMock;
1919
private Mock<IChannelSession> _channelSessionMock;
20-
private Mock<ISftpResponseFactory> _sftpMessageFactoryMock;
20+
private Mock<ISftpResponseFactory> _sftpResponseFactoryMock;
2121
private SftpSession _sftpSession;
2222
private int _operationTimeout;
2323
private Encoding _encoding;
@@ -94,7 +94,7 @@ private void CreateMocks()
9494
{
9595
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
9696
_channelSessionMock = new Mock<IChannelSession>(MockBehavior.Strict);
97-
_sftpMessageFactoryMock = new Mock<ISftpResponseFactory>(MockBehavior.Strict);
97+
_sftpResponseFactoryMock = new Mock<ISftpResponseFactory>(MockBehavior.Strict);
9898
}
9999

100100
private void SetupMocks()
@@ -113,7 +113,7 @@ private void SetupMocks()
113113
_channelSessionMock.Raise(c => c.DataReceived += null,
114114
new ChannelDataEventArgs(0, _sftpVersionResponse.GetBytes()));
115115
});
116-
_sftpMessageFactoryMock.InSequence(sequence)
116+
_sftpResponseFactoryMock.InSequence(sequence)
117117
.Setup(p => p.Create(0U, (byte) SftpMessageTypes.Version, _encoding))
118118
.Returns(_sftpVersionResponse);
119119
_channelSessionMock.InSequence(sequence).Setup(p => p.IsOpen).Returns(true);
@@ -123,7 +123,7 @@ private void SetupMocks()
123123
_channelSessionMock.Raise(c => c.DataReceived += null,
124124
new ChannelDataEventArgs(0, _sftpNameResponse.GetBytes()));
125125
});
126-
_sftpMessageFactoryMock.InSequence(sequence)
126+
_sftpResponseFactoryMock.InSequence(sequence)
127127
.Setup(p => p.Create(_protocolVersion, (byte) SftpMessageTypes.Name, _encoding))
128128
.Returns(_sftpNameResponse);
129129

@@ -136,7 +136,7 @@ private void SetupMocks()
136136
_channelSessionMock.Raise(c => c.DataReceived += null,
137137
new ChannelDataEventArgs(0, _sftpDataResponseBytes));
138138
});
139-
_sftpMessageFactoryMock.InSequence(sequence)
139+
_sftpResponseFactoryMock.InSequence(sequence)
140140
.Setup(p => p.Create(_protocolVersion, (byte) SftpMessageTypes.Data, _encoding))
141141
.Returns(new SftpDataResponse(_protocolVersion));
142142
}
@@ -147,7 +147,7 @@ protected void Arrange()
147147
CreateMocks();
148148
SetupMocks();
149149

150-
_sftpSession = new SftpSession(_sessionMock.Object, _operationTimeout, _encoding, _sftpMessageFactoryMock.Object);
150+
_sftpSession = new SftpSession(_sessionMock.Object, _operationTimeout, _encoding, _sftpResponseFactoryMock.Object);
151151
_sftpSession.Connect();
152152
}
153153

src/Renci.SshNet.Tests/Classes/SftpClientTest_Dispose_Connected.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public class SftpClientTest_Dispose_Connected
1010
{
1111
private Mock<IServiceFactory> _serviceFactoryMock;
1212
private Mock<ISession> _sessionMock;
13-
private Mock<ISftpResponseFactory> _sftpMessageFactoryMock;
13+
private Mock<ISftpResponseFactory> _sftpResponseFactoryMock;
1414
private Mock<ISftpSession> _sftpSessionMock;
1515
private SftpClient _sftpClient;
1616
private ConnectionInfo _connectionInfo;
@@ -32,7 +32,7 @@ protected void Arrange()
3232
{
3333
_serviceFactoryMock = new Mock<IServiceFactory>(MockBehavior.Strict);
3434
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
35-
_sftpMessageFactoryMock = new Mock<ISftpResponseFactory>(MockBehavior.Strict);
35+
_sftpResponseFactoryMock = new Mock<ISftpResponseFactory>(MockBehavior.Strict);
3636
_sftpSessionMock = new Mock<ISftpSession>(MockBehavior.Strict);
3737

3838
_connectionInfo = new ConnectionInfo("host", "user", new NoneAuthenticationMethod("userauth"));
@@ -46,10 +46,10 @@ protected void Arrange()
4646
.Returns(_sessionMock.Object);
4747
_sessionMock.InSequence(sequence).Setup(p => p.Connect());
4848
_serviceFactoryMock.InSequence(sequence)
49-
.Setup(p => p.CreateSftpMessageFactory())
50-
.Returns(_sftpMessageFactoryMock.Object);
49+
.Setup(p => p.CreateSftpResponseFactory())
50+
.Returns(_sftpResponseFactoryMock.Object);
5151
_serviceFactoryMock.InSequence(sequence)
52-
.Setup(p => p.CreateSftpSession(_sessionMock.Object, _operationTimeout, _connectionInfo.Encoding, _sftpMessageFactoryMock.Object))
52+
.Setup(p => p.CreateSftpSession(_sessionMock.Object, _operationTimeout, _connectionInfo.Encoding, _sftpResponseFactoryMock.Object))
5353
.Returns(_sftpSessionMock.Object);
5454
_sftpSessionMock.InSequence(sequence).Setup(p => p.Connect());
5555
_sessionMock.InSequence(sequence).Setup(p => p.OnDisconnecting());
@@ -67,14 +67,14 @@ protected void Act()
6767
[TestMethod]
6868
public void CreateSftpMessageFactoryOnServiceFactoryShouldBeInvokedOnce()
6969
{
70-
_serviceFactoryMock.Verify(p => p.CreateSftpMessageFactory(), Times.Once);
70+
_serviceFactoryMock.Verify(p => p.CreateSftpResponseFactory(), Times.Once);
7171
}
7272

7373
[TestMethod]
7474
public void CreateSftpSessionOnServiceFactoryShouldBeInvokedOnce()
7575
{
7676
_serviceFactoryMock.Verify(
77-
p => p.CreateSftpSession(_sessionMock.Object, _operationTimeout, _connectionInfo.Encoding, _sftpMessageFactoryMock.Object),
77+
p => p.CreateSftpSession(_sessionMock.Object, _operationTimeout, _connectionInfo.Encoding, _sftpResponseFactoryMock.Object),
7878
Times.Once);
7979
}
8080

0 commit comments

Comments
 (0)