views:

130

answers:

2

Assume an interface, for example:

public interface ISimple
{
    void GetBytes(byte[]);
    void GetNonZeroBytes(byte[]);
}

Then one or more implementation of that interface. What is the best way to test those implementations wile still adhering to DRY?

What I have been doing so far is creating a base test fixture will all the test attributes and abstract methods where needed (create instance, etc) and then implementing a subclass of the fixture for any new implementations of ISimple. This also has the added benefit of being able to test implementation specifics on the new class.

However this just doesn't "seem right" as there is a lot work to get the test for the initial implantation done.

How have others handled this situation in the past?

+1  A: 

this was largely resolved here

James A. Rosen
A: 

@Gaius Thank you, I had read that question, but not far enough into the comments. It looks like they are recommending exactly what I am already doing. Given they are not the exact same questions I am going to keep this unanswered for a awhile and if no other responses come in I will give it to you.

Andrew Burns