Assume the following implementation of the template method:
public abstract class Abs
{
void DoYourThing()
{
log.Info("Starting");
try
{
DoYourThingInternal();
log.Info("All done");
}
catch (MyException ex)
{
log.Error("Something went wrong here!");
throw;
}
}
protected abstract void DoYourThingInternal();
}
Now there is a lot of information on how to test the class Abs, and make sure it is called DoYourThingInternal.
However, suppose I want to check the class Conc:
public class Conc : Abs
{
protected override void DoYourThingInternal()
{
}
}
I would not want to do conc.DoYourThing(), as this will call the parent method, which has already been tested separately.
I would like to test only the override method.
Any ideas?
J. Ed source
share