Add tests to validate command structures.

We've been tripped up a couple of times by changes to the commands data structures which could have been picked up by the tests.