may help you . You should create interfaces in order to make testing code that depends on your data easier. Having interfaces and coding to these interfaces means you can inject mocks and stubs in your tests.
seems to work fine In your IConnection example you're basically describing an abstract Connect() method, since each class will have to implement its own version. Usually (always?) abstract methods can only be defined with the same parameters, so Connect(username, password) and Connect(key) couldn't be implementations of the same Connect() method from an interface. Now, at this point, you could define it as IConnection::Connect(SomeConnectionData) and derive UsernamePasswordConnectionData and KeyConnectionData, etc., etc. from that SomeConnectionData class but all this would be so hard to explain and implement that its pretty good clue that interfaces and inheritance aren't helping the situation.
How to deserialize collection of interfaces when concrete classes contains other interfaces
hope this fix your issue Your basic problem is that your ConcreteConverter is designed to deserialize something declared as an interface as a concrete type -- e.g. IItemModel as Item -- but you are not using it in that way. You are using it to deserialize a concrete list of interfaces as a concrete list of concrete types, e.g.: