Skip to content

Commit 754d8e3

Browse files
committed
udpate by comments
1 parent 3b6578b commit 754d8e3

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ ms.author: azfuncdf
1212
Unit testing is an important part of modern software development practices. Unit tests verify business logic behavior and protect from introducing unnoticed breaking changes in the future. Durable Functions can easily grow in complexity so introducing unit tests helps avoid breaking changes. The following sections explain how to unit test the three function types - Orchestration client, orchestrator, and activity functions.
1313

1414
> [!NOTE]
15-
> This article provides guidance for unit testing for Durable Functions apps written in C# for the .NET out-of-process worker. For more information about Durable Functions in the .NET isolated worker, see the [Durable Functions in the .NET isolated worker](durable-functions-dotnet-isolated-overview.md) article.
16-
> The complete sample code for this unit testing guide can be found in [the sample code repository](https://github.com/Azure/azure-functions-durable-extension/tree/dev/samples/isolated-unit-tests).
15+
> This article provides guidance for unit testing for Durable Functions apps written in C# for the .NET isolated worker. For more information about Durable Functions in the .NET isolated worker, see the [Durable Functions in the .NET isolated worker](durable-functions-dotnet-isolated-overview.md) article.
16+
> **The complete sample code for this unit testing guide can be found in [the sample code repository](https://github.com/Azure/azure-functions-durable-extension/tree/dev/samples/isolated-unit-tests)**.
17+
> The unit testing guide for Durable Functions written in C# in-process can be found [here](durable-functions-unit-testing.md).
1718
1819
## Prerequisites
1920

@@ -33,7 +34,7 @@ Mocking is supported via the following interfaces and classes:
3334
* `FunctionContext` - For function execution context
3435
* `HttpRequestData` and `HttpResponseData` - For HTTP trigger functions
3536

36-
These classes can be used with the various trigger and bindings supported by Durable Functions. While it is executing your Azure Functions, the functions runtime runs your function code with concrete implementations of these classes. For unit testing, you can pass in a mocked version of these classes to test your business logic.
37+
These classes can be used with the various trigger and bindings supported by Durable Functions. While it's executing your Azure Functions, the functions runtime runs your function code with concrete implementations of these classes. For unit testing, you can pass in a mocked version of these classes to test your business logic.
3738

3839
## Unit testing trigger functions
3940

@@ -65,7 +66,7 @@ var durableClientMock = new Mock<DurableTaskClient>("testClient");
6566
var functionContextMock = new Mock<FunctionContext>();
6667
```
6768

68-
Then `ScheduleNewOrchestrationInstanceAsync` method is mocked to return a instance ID:
69+
Then `ScheduleNewOrchestrationInstanceAsync` method is mocked to return an instance ID:
6970

7071
```csharp
7172
var instanceId = Guid.NewGuid().ToString();
@@ -170,7 +171,8 @@ Assert.Equal(instanceId, serializedResponseBody!.GetProperty("Id").GetString());
170171
```
171172

172173
> [!NOTE]
173-
> Currently, loggers created via FunctionContext in trigger functions are not supported for mocking in unit tests.
174+
> Currently, loggers created via FunctionContext in trigger functions aren't supported for mocking in unit tests.
175+
174176

175177
## Unit testing orchestrator functions
176178

@@ -179,7 +181,7 @@ Orchestrator functions manage the execution of multiple activity functions. To t
179181
* Mock the `TaskOrchestrationContext` to control function execution
180182
* Replace `TaskOrchestrationContext` methods needed for orchestrator execution like `CallActivityAsync` with mock functions
181183
* Call the orchestrator directly with the mocked context
182-
* Verify the orchestrator result using assertions
184+
* Verify the orchestrator results using assertions
183185

184186
In this section, the unit test validates the behavior of the `HelloCities` orchestrator function:
185187

@@ -296,7 +298,7 @@ public void SayHello_ReturnsExpectedGreeting()
296298
```
297299

298300
> [!NOTE]
299-
> Currently, loggers created via FunctionContext in activity functions are not supported for mocking in unit tests.
301+
> Currently, loggers created via FunctionContext in activity functions aren't supported for mocking in unit tests.
300302
301303
## Next steps
302304

0 commit comments

Comments
 (0)