You can use AutoFixture.Idioms for that, although by default it'll test for ArgumentNullException
because null
is really the only invalid value for an interface.
You can write something like this to check all members for invalid values (including members that take ITable
as an argument):
var fixture = new Fixture();
var assertion = new GuardClauseAssertion(fixture);
assertion.Verify(typeof(MyType));
The Verify
call will throw an exception if it passing null
as an argument doesn't throw an ArgumentNullException
.
There are lots of options for narrowing down the selection. As an example, there's a Verify
overload that takes IEnumerable<MemberInfo>
, so you can use Reflection to query your type for all members that have an ITable
argument.
If you need specific help with AutoFixture or AutoFixture.Idioms, please ask a new question and tag it autofixture, as it can become a bit tiresome answering complex questions in the comments :)