Data contracts should be findable / enumerable
The idea is this: There are certain requirements on a data contract; like it being serializable and whatnot.
To verify this automagically the test program must be able to find them.
It can be done through:
1) they are all in the same namespace.
2) their names are all suffixed with “DataContract”
3) they all implement “IDataContract”
Then through reflection/RTTI a test can get all data contracts and verify they are all ok.
Unfortunately Aspnet does not have a way to verify that an endpoint returns a data contract through unit testing; it has to be solved through integration testing or surveillance of production.
Update: I created a dotnet utility for finding all classes decorated with a certain attribute to verify they all had a default constructor. It is called “Constructor.IsDefaultImplemented” and look here to see how to use it in your unit test.