Skip to content

Commit f7a21f5

Browse files
committed
update guide
1 parent 02c2964 commit f7a21f5

File tree

1 file changed

+1
-29
lines changed

1 file changed

+1
-29
lines changed

articles/azure-functions/durable/durable-functions-unit-testing-dotnet-isolated.md

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -183,34 +183,6 @@ Orchestrator functions manage the execution of multiple activity functions. To t
183183

184184
In this section, the unit test validates the behavior of the `HelloCities` orchestrator function:
185185

186-
```csharp
187-
[Function(nameof(HelloCitiesOrchestration))]
188-
public static async Task<List<string>> HelloCities(
189-
[OrchestrationTrigger] TaskOrchestrationContext context)
190-
{
191-
ILogger logger = context.CreateReplaySafeLogger(nameof(Function1));
192-
logger.LogInformation("Saying hello.");
193-
var outputs = new List<string>();
194-
195-
outputs.Add(await context.CallActivityAsync<string>(nameof(SayHello), "Tokyo"));
196-
outputs.Add(await context.CallActivityAsync<string>(nameof(SayHello), "Seattle"));
197-
outputs.Add(await context.CallActivityAsync<string>(nameof(SayHello), "London"));
198-
199-
return outputs;
200-
}
201-
```
202-
203-
## Unit testing orchestrator functions
204-
205-
Orchestrator functions manage the execution of multiple activity functions. To test an orchestrator:
206-
207-
* Mock the `TaskOrchestrationContext` to control function execution
208-
* Replace `TaskOrchestrationContext` methods needed for orchestrator execution like `CallActivityAsync` with mock functions
209-
* Call the orchestrator directly with the mocked context
210-
* Verify the orchestrator result using assertions
211-
212-
In this section, the unit test validates the behavior of the `HelloCities` orchestrator function:
213-
214186
```csharp
215187
[Function(nameof(HelloCitiesOrchestration))]
216188
public static async Task<List<string>> HelloCities(
@@ -324,7 +296,7 @@ public void SayHello_ReturnsExpectedGreeting()
324296
```
325297

326298
> [!NOTE]
327-
> Currently, loggers created via FunctionContext in trigger functions are not supported for mocking in unit tests.
299+
> Currently, loggers created via FunctionContext in activity functions are not supported for mocking in unit tests.
328300
329301
## Next steps
330302

0 commit comments

Comments
 (0)