I've already checked this.. similar question but I am not convinced about the answers...
I currently have an interface that is only being implemented by one class, but that is going to change sooner or later. I currently have a test against the interface, and all tests at the beginning start with:
IFoo foo = GetConcreteFoo()
where GetConcreteFoo is something like
IFoo GetConcreteFoo()
{
return new ConcreteFooA();
}
however, when I get more implementations of Foo, could there be a way to make all the test run against a list of all the different concrete foos?
Im thinking that if there is no way, at least I can copy/paste the test into a new file, with the name of the concreteclass, and change the return object of the GetConcreteFoo... (and changing the original file from (IFooTests to IConcreteFooATests).
I dont think this method is particularly bad.. but its not too elegant/clever, as it would be to run the same test (file) against all concrete implementations.
Is there a way to make it do that?
(Im using MSTests )
Thanks!