Refactored usage of IdFactory in tests. Added tests for `GuardedRegistry` decorator