I'm wondering how can I mock IO/Network classes. For example I have a class that do FTP operations or a class that writes into a file. How can I use mocking to mock and unit test such classes?
I'm a C#/NHibernate/Castle ActiveRecord/Rhino Mocks developer.
Using Rhino Mocks you can mock only interfaces, abstract classes (virtual methods in general). So abstract your network access code into interfaces and then mock them in order to unit test other classes depending on them in isolation.
You cannot unit test code that needs to connect to an FTP server in isolation. That's no longer an unit test, it's an integration test and mocking cannot help you here.