Just figured this out. Here's how to create an instance of your app intent with a custom dependency manager:
let dependencyManager = AppDependencyManager()
dependencyManager.add(dependency: 5)
let appIntent = TestAppIntent(count: .init(manager: dependencyManager))
let _ = try await appIntent.resolveAndPerform()
Your way with an extension should work too, but is unnecessary if your code can access the intent type's default .init() method.
You have to use .resolveAndPerform() to get the dependency injection to happen, .perform() alone doesn't do it.
Topic:
App & System Services
SubTopic:
Automation & Scripting
Tags: