dotnet-sdk icon indicating copy to clipboard operation
dotnet-sdk copied to clipboard

WorkflowActivityContext cannot be mocked

Open bgelens opened this issue 1 year ago • 3 comments

WorkflowActivityContext has an internal constructor only and it's not implementing an interface making it impossible? to mock.

For DaprWorkflowContext I can just use the abstract WorkflowContext so I'm not having this issue when unit testing orchestration workflow.

I suggest the same approach for WorkflowActivityContext as with WorkflowContext, make it abstract without constructor definition and derive a DaprWorkflowActivityContext. Or alternate solutions like adding an interface, make the constructor public or internal protected (that way we can derive a stub I think? by exposing internals via our csproj referencing the workflow package)

I think not being able to mock the ActivityContext is a blocker for us moving forward with Dapr Workflow

bgelens avatar Dec 04 '23 06:12 bgelens