So I have a class that looks something like the following:
public class MyClass
{
DatabaseDependency _depend;
public MyClass(DatabaseDependency depend)
{
_depend = depend;
}
public string DoSomething(DBParameter database)
{
var result = _depend.GetResults(database, ...);
string response = String.Empty;
// some logic to process the result
return response;
}
}
Where DBParameter is a simple value class which contains properties like Server, DBName, DBType, etc.
Now, I want to add an overload to DoSomething so that it accepts a connection string instead of the DBParameter parameter (assume that DatabaseDependency already has a GetResults overload which accepts a connection string).
My question: I have several unit tests which describe the various logical paths used to process result from DatabaseDependency.GetResults. When I add the overload to DoSomething, I would essentially refactor the code so that this logic is reused by both overloads (i.e. probably move it to a private method). What is the right way to go about unit testing this? Do I need to have just as many unit tests to verify all logical paths for the new overload I am adding?