Is there a common test suite for testing the ICollection / IEnumerable / IList modules?

I am looking for a set of general unit tests that will cover the bases for developers of one (or several) .NET collection interfaces. I am sure that this has been done many times before, and it makes no sense to repeat it again, right? I don't care if it's NUnit, MSTest, C #, VB, etc. I can adapt.

+4
source share
1 answer

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.

+1
source

Source: https://habr.com/ru/post/1341340/


All Articles