Begin caching child item counts as a property, starting with doc
units and repositories.

Also reorganise some tests and add a couple of new ones.