-
-
Notifications
You must be signed in to change notification settings - Fork 931
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add interface to SftpClient. #193
Comments
…ng and testing purposes.
This really should be merged! Along with ISftpFile interface for SftpFile :) In my project I have implemented wrappers with interfaces IFtpFileWrapper and IFtpClientWrapper to be able to separate SSH.Net from most of my classes and enable unit testing. But it is not very pretty :( |
…ng and testing purposes.
Add ISftpClient interface to **SftpClient for mocking and testing purposes. Fixes sshnet#193.
Im still having a hard time mocking some of the methods in the SftpClient. |
@benjaminoerskov I would say that Connect is a pretty important part of the abstraction. An interface for communicating with a FTP server is not of much use if you can't connect to it 😊 |
Are there any plans to add the Connect method to the interface? |
Yeap...connect should definitely be in the interface. |
I found this answer, because I'm sitting in the same situation. To be able to use SftpClient with Dependency Injection, I need to Connect when I inject the client into my dependent classes, which feels wrong. If something goes wrong with Connect, it shouldn't be thrown from the injecting part, but instead inside the dependent class. At least in my case. |
All of this should be fixed in #975 but we're still waiting for it to be released |
Can we get a readme update with some use cases on how to connect using the interface? |
@berv63 it's impossible as it is now, but exactly the same as using the class directly when this PR gets released |
This would be handy to have for testing and mocking and I'd like to contribute to this feature if possible.
The text was updated successfully, but these errors were encountered: