So here is the script, I'm refactoring the spaghetti code. My first problem was the class chain, which created new classes, I fixed it by making the ctor of the class I want to check (Search.cs), take the class that it needs as a dependency, now it looks like this.
public Search(XmlAccess xmlFile, SearchDatabaseConnect searchDatabaseConnection) { this.xmlFile = xmlFile; FsdcConnection = searchDatabaseConnection; Clear(); }
I am new to the chain. This is all good, but I have a little problem.
The class that I inject inherits from another class, I have Resharper, and I have the extracted interfaces, but the problem is that the dependency class inherits from another specific class - let's see what I mean?
public class SearchDatabaseConnect : DatabaseConnect, ISearchDatabaseConnect {
I donโt know what to do with inheritance on DatabaseConnect? How am I kidding? Obviously, if it werenโt, I would have set everything up, I could have mocked ISearchDatabaseConnect, and we are leaving, but I'm stuck in inheriting a specific class. I am sure that people came across this before my googl'ing was unsuccessful when it came to finding examples about it.
Thanks in advance for any helpful suggestions.
source share