Add tests to ensure that @AutoFactory works when applied to constructors

Also adds a fix that makes sure that it works.