Refactor OperatorFactory tests. Centralize code.