Hello,
I am coding a project using Alex FTPS Client as a library to provide FTP capabilities.
I use MoQ to unit test my code, but i can't mock FTPSClient. The problem is most of mocking libraries need the mocked code to be an interface, an abstract or non-sealed class.
Would it be possible to make Alex FTPS Client mockable ?
Thanks
Comments: ** Comment from web user: Jissai **
I am coding a project using Alex FTPS Client as a library to provide FTP capabilities.
I use MoQ to unit test my code, but i can't mock FTPSClient. The problem is most of mocking libraries need the mocked code to be an interface, an abstract or non-sealed class.
Would it be possible to make Alex FTPS Client mockable ?
Thanks
Comments: ** Comment from web user: Jissai **
Hello,
I tried the workaround and removed "sealed".
I go one step further but apparently when mocking a class, MoQ needs the methods to be virtual.
I confirmed this by making "Connect" methods virtual.
The better approach would be to have interface though.
Thank you.