teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

バージョン 2016.1.0 のソースに合わせました。

2024/04/11 16:47

投稿

usugita_san
usugita_san

スコア228

title CHANGED
File without changes
body CHANGED
@@ -7,19 +7,19 @@
7
7
 
8
8
  必要なのはSftpFileのインスタンスです。ファイルのパス、名前を取得したいと思っています。
9
9
  SftpFileのコンストラクタには ISftpSession インターフェースが必要です。
10
- https://github.com/sshnet/SSH.NET/blob/master/src/Renci.SshNet/Sftp/SftpFile.cs
10
+ https://github.com/sshnet/SSH.NET/blob/2016.1.0/src/Renci.SshNet/Sftp/SftpFile.cs
11
11
 
12
12
  しかし、 ISftpSessionインターフェースはinternalです。Moqを使用して生成する事は出来ません。
13
- https://github.com/sshnet/SSH.NET/blob/master/src/Renci.SshNet/Sftp/ISftpSession.cs
13
+ https://github.com/sshnet/SSH.NET/blob/2016.1.0/src/Renci.SshNet/Sftp/ISftpSession.cs
14
14
 
15
15
  ISftpSessionのインスタンスを生成しているのは、 Renci.SshNet.ServiceFactory ですが、これもinternalなので生成できません。
16
- https://github.com/sshnet/SSH.NET/blob/master/src/Renci.SshNet/ServiceFactory.cs
16
+ https://github.com/sshnet/SSH.NET/blob/2016.1.0/src/Renci.SshNet/ServiceFactory.cs
17
17
 
18
18
  ServiceFactoryを生成しているのはSftpClientのようです。しかし、SftpClientを生成するにはConnectionInfoが必要です。
19
19
  ConnectionInfoはnew して生成できますが、当然接続先を設定する必要があります。
20
20
 
21
21
  ConnectionInfoのMockを作ってどうにかしようかと試みましたが、Session.csでConnectionInfoを使用しており、ここではSSH接続を作らないといけないようです。
22
- https://github.com/sshnet/SSH.NET/blob/master/src/Renci.SshNet/Session.cs
22
+ https://github.com/sshnet/SSH.NET/blob/2016.1.0/src/Renci.SshNet/Session.cs
23
23
 
24
24
  つまり、ここまで調べた通りだと必ずSSHの接続が必要になってしまいます。
25
25
  やはりSSH接続を行うしか無いのでしょうか?

1

リポジトリが間違えていました。ご指摘ありがとうございました。

2024/04/11 16:11

投稿

usugita_san
usugita_san

スコア228

title CHANGED
File without changes
body CHANGED
@@ -7,19 +7,19 @@
7
7
 
8
8
  必要なのはSftpFileのインスタンスです。ファイルのパス、名前を取得したいと思っています。
9
9
  SftpFileのコンストラクタには ISftpSession インターフェースが必要です。
10
- https://github.com/zeevl/Renci.SshNet/blob/master/Renci.SshNet/Sftp/SftpFile.cs
10
+ https://github.com/sshnet/SSH.NET/blob/master/src/Renci.SshNet/Sftp/SftpFile.cs
11
11
 
12
12
  しかし、 ISftpSessionインターフェースはinternalです。Moqを使用して生成する事は出来ません。
13
- https://github.com/zeevl/Renci.SshNet/blob/master/Renci.SshNet/Sftp/ISftpSession.cs
13
+ https://github.com/sshnet/SSH.NET/blob/master/src/Renci.SshNet/Sftp/ISftpSession.cs
14
14
 
15
15
  ISftpSessionのインスタンスを生成しているのは、 Renci.SshNet.ServiceFactory ですが、これもinternalなので生成できません。
16
- https://github.com/zeevl/Renci.SshNet/blob/master/Renci.SshNet/ServiceFactory.cs
16
+ https://github.com/sshnet/SSH.NET/blob/master/src/Renci.SshNet/ServiceFactory.cs
17
17
 
18
18
  ServiceFactoryを生成しているのはSftpClientのようです。しかし、SftpClientを生成するにはConnectionInfoが必要です。
19
19
  ConnectionInfoはnew して生成できますが、当然接続先を設定する必要があります。
20
20
 
21
21
  ConnectionInfoのMockを作ってどうにかしようかと試みましたが、Session.csでConnectionInfoを使用しており、ここではSSH接続を作らないといけないようです。
22
- https://github.com/zeevl/Renci.SshNet/blob/master/Renci.SshNet/Session.cs
22
+ https://github.com/sshnet/SSH.NET/blob/master/src/Renci.SshNet/Session.cs
23
23
 
24
24
  つまり、ここまで調べた通りだと必ずSSHの接続が必要になってしまいます。
25
25
  やはりSSH接続を行うしか無いのでしょうか?