refs #10102. Refactor to base test class.

Templated base class taking algorithm as type argument. Shared test code is much neater now. Duplication is at an absolute minimal.