From fd8011e46f9681168e14be0e56e8c9bbdfa0aa55 Mon Sep 17 00:00:00 2001 From: MregXN Date: Fri, 24 Nov 2023 21:37:27 +0800 Subject: [PATCH] modify readme Signed-off-by: MregXN --- examples/Workflow/README.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/examples/Workflow/README.md b/examples/Workflow/README.md index e119465c3..0bf058025 100644 --- a/examples/Workflow/README.md +++ b/examples/Workflow/README.md @@ -16,9 +16,17 @@ Dapr workflow, as well as this example program, now support authentication throu ## Projects in sample This sample contains a single [WorkflowConsoleApp](./WorkflowConsoleApp) .NET project. -It utilizes the workflow SDK as well as the workflow management API for starting and querying workflows instances. -The main `Program.cs` file contains the main setup of the app, including the registration of the workflow and workflow activities. -The workflow definition is found in the `Workflows` directory and the workflow activity definitions are found in the `Activities` directory. +It utilizes the workflow SDK as well as the workflow management API for simulating inventory management and sale of goods in a store. +The main `Program.cs` file contains the main setup of the app, the registration of the workflow and its activities, and interaction with the user. The workflow definition is found in the `Workflows` directory and the workflow activity definitions are found in the `Activities` directory. + +There are five activities in the directory that could be called by the workflows: +- `NotifyActivity`: printing logs as notifications +- `ProcessPaymentActivity`: printing logs and delaying for simulating payment processing +- `RequestApprovalActivity`: printing logs to indicate that the order has been approved +- `ReserveInventoryActivity`: checking if there are enough items for purchase +- `UpdateInventoryActivity`: updating the statestore according to purchasing + +The `OrderProcessingWorkflow.cs` in `Workflows` directory implements the running logic of the workflow. Based on the purchase stage and outcome, it calls different activities and waits for the corresponding events to trigger interaction with the user. This sample also contains a [WorkflowUnitTest](./WorkflowUnitTest) .NET project that utilizes [xUnit](https://xunit.net/) and [Moq](https://github.com/moq/moq) to test the workflow logic. It works by creating an instance of the `OrderProcessingWorkflow` (defined in the `WorkflowConsoleApp` project), mocking activity calls, and testing the inputs and outputs.