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.

Leave a Reply