I have two classes
public abstract class BaseClass
{
public string PropertyA {get; set;}
public virtual object CopyProperties(BaseClass other)
{
other.PropertyA = this.PropertyA;
}
}
and a class which inherits from it
public class ChildClass : BaseClass
{
public string PropertyB {get; set;}
public virtual object CopyProperties(BaseClass other)
{
other.PropertyB = this.PropertyB;
base.CopyProperties(other);
}
}
Naturally I've unit tested such complex logic!
I have two tests:
Ensure_calling_CloneProperties_copies_PropertyA() Ensure_calling_CloneProperties_copies_PropertyB()
I want to know whether the following test is also required
Ensure_calling_CloneProperties_on_ChildClass_calls_base()
My personal opinion is that we should test the behaviour of CloneProperties on the ChildClass, we need to verify that when we call clone PropertyA and PropertyB are both copied correctly - we do not need (or want) to know how this is achieved. However a colleague disagrees.
Given agile and TDD best practices should I also create the third test?