@@ -20,6 +20,7 @@ public class ScpClientTest_Upload_FileInfoAndPath_SendExecRequestReturnsFalse
20
20
private ScpClient _scpClient ;
21
21
private FileInfo _fileInfo ;
22
22
private string _path ;
23
+ private string _quotedPath ;
23
24
private string _fileName ;
24
25
private IList < ScpUploadEventArgs > _uploadingRegister ;
25
26
private SshException _actualException ;
@@ -48,6 +49,7 @@ protected void Arrange()
48
49
_connectionInfo = new ConnectionInfo ( "host" , 22 , "user" , new PasswordAuthenticationMethod ( "user" , "pwd" ) ) ;
49
50
_fileInfo = new FileInfo ( _fileName ) ;
50
51
_path = random . Next ( ) . ToString ( CultureInfo . InvariantCulture ) ;
52
+ _quotedPath = _path . ShellQuote ( ) ;
51
53
_uploadingRegister = new List < ScpUploadEventArgs > ( ) ;
52
54
53
55
_serviceFactoryMock = new Mock < IServiceFactory > ( MockBehavior . Strict ) ;
@@ -64,8 +66,7 @@ protected void Arrange()
64
66
_sessionMock . InSequence ( sequence ) . Setup ( p => p . CreateChannelSession ( ) ) . Returns ( _channelSessionMock . Object ) ;
65
67
_channelSessionMock . InSequence ( sequence ) . Setup ( p => p . Open ( ) ) ;
66
68
_channelSessionMock . InSequence ( sequence )
67
- . Setup (
68
- p => p . SendExecRequest ( string . Format ( "scp -t \" {0}\" " , _path ) ) ) . Returns ( false ) ;
69
+ . Setup ( p => p . SendExecRequest ( string . Format ( "scp -t {0}" , _quotedPath ) ) ) . Returns ( false ) ;
69
70
_channelSessionMock . InSequence ( sequence ) . Setup ( p => p . Dispose ( ) ) ;
70
71
_pipeStreamMock . As < IDisposable > ( ) . InSequence ( sequence ) . Setup ( p => p . Dispose ( ) ) ;
71
72
@@ -98,7 +99,7 @@ public void UploadShouldHaveThrownSshException()
98
99
[ TestMethod ]
99
100
public void SendExecREquestOnChannelSessionShouldBeInvokedOnce ( )
100
101
{
101
- _channelSessionMock . Verify ( p => p . SendExecRequest ( string . Format ( "scp -t \" {0}\" " , _path ) ) , Times . Once ) ;
102
+ _channelSessionMock . Verify ( p => p . SendExecRequest ( string . Format ( "scp -t {0}" , _quotedPath ) ) , Times . Once ) ;
102
103
}
103
104
104
105
[ TestMethod ]
0 commit comments