Dotnet examples awaiting signal

I’m looking for some examples in dotnet where a workflow is awaiting a signal response.

In my instance the workflow is awaiting an API call from an external microservice to continue on to the next activity:

await Workflow.WaitConditionAsync(() => _created != null && _created.ProjectName == controllerSlug);

Once this is reached within the test it hangs awaiting this signal. Manual testing works fine, but I need a way to bump the signal to finish the last mocked activity.

I am using the WorkflowEnvironment.StartLocalAsync(); so I was hoping there was maybe some build in functionality to trigger the signal to move on. The docs haven’t been super helpful thus far on this.

I may be misunderstanding the ask, but in general you can just use the client in the test with the workflow handle to send a signal to the workflow, same as you might in a non-test situation. See Workflow message passing - .NET SDK | Temporal Platform Documentation.

1 Like

Ah brilliant thank you! Yes I just implemented a handle and this did seem to now bump over it:

            await handle.SignalAsync(wf => wf.ControllerCreatedSignal(
                new SignalCreated()
                {

                    WorkflowId = workflowId,
                    ProjectName = "test-controller",
                    Response = "test",
                    StatusCode = HttpStatusCode.OK

                }

            ));