.Net 2.0 has been out for a while and it seems that 'generics' have not made it into unit test frameworks (that I know of). When I write unit tests for generics, I don't want to have to instantiate them!
For example, if I have an generic interface,
interface IFoo<T> {...}
then I'd really like to write this kind of test and let the test framework figure out an interresting instantiation (i.e. choice of T):
[Test]public void Test<T>(IFoo<T> foo) { ... }
In the example above, System.Object can be trivially used to instantiate IFoo<T>. Of course, things get more interresting when mixing type argument, method argument and constraints :)
interface IFoo<T>{ R Bar<R>(T t) where R : IEnumerable<T>}
In Pex, we've started to look at this problem... stay tuned.
Page rendered at Sunday, September 07, 2008 8:17:36 PM UTC
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.