Microsoft Pex has great support for this. It has standard tests for interfaces built into the infrastructure that test the semantic contract. Is this what you want. If you invest 3 hours of Pex training, you will not regret it.
This is TDD at its best. First write a test and Pex will adapt to your implementation until the most recent error is found. An empty implementation is well tested with pex. He just finds the error very quickly, thatβs all.
You can allocate all your general testing logic to a specific interface. Pex even supports general tests, which means that you can write a test for an arbitrary instance of IComparer and say: run this test with the following types.
source share