Quantcast
Channel: Alex FTPS Client
Viewing all articles
Browse latest Browse all 114

Commented Issue: Mocking capabilities [8722]

$
0
0
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 **

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.


Viewing all articles
Browse latest Browse all 114

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>