-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sample: sample for workflow ExecuteByQS(http)&& correct typo in Workf…
…lowGlobalTransaction class name (#92) * sample: sample for workflow ExecuteByQS - Implement wf-crash endpoint to simulate workflow crash - Implement wf-resume endpoint for workflow http callback - Modify WorlflowGlobalTransaction.cs to add Exists method for debug only. * refactor(Dtmworkflow): correct typo in WorkflowGlobalTransaction class name - Rename WorlflowGlobalTransaction to WorkflowGlobalTransaction - Update references in ServiceCollectionExtensions, WfTestController, and tests * test: add unit tests for WorkflowGlobalTransaction.Exists method
- Loading branch information
Showing
6 changed files
with
142 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using Dtmcli; | ||
using Dtmgrpc; | ||
using Microsoft.Extensions.Logging.Abstractions; | ||
using Moq; | ||
|
||
namespace Dtmworkflow.Tests; | ||
|
||
public class WorkflowGlobalTransactionTest | ||
{ | ||
#if DEBUG | ||
[Fact] | ||
public void Exists() | ||
{ | ||
var factory = new Mock<IWorkflowFactory>(); | ||
var wf = new WorkflowGlobalTransaction(factory.Object, NullLoggerFactory.Instance); | ||
|
||
Assert.Throws<System.ArgumentNullException>(() => wf.Exists(null)); | ||
Assert.False(wf.Exists(string.Empty)); | ||
Assert.False(wf.Exists("my-wf1")); | ||
Assert.False(wf.Exists("my-wf2")); | ||
Assert.False(wf.Exists("my-wf3")); | ||
|
||
wf.Register("my-wf1", (workflow, data) => null); | ||
wf.Register("my-wf2", (workflow, data) => null); | ||
|
||
Assert.Throws<System.ArgumentNullException>(() => wf.Exists(null)); | ||
Assert.False(wf.Exists(string.Empty)); | ||
Assert.True(wf.Exists("my-wf1")); | ||
Assert.True(wf.Exists("my-wf2")); | ||
Assert.False(wf.Exists("my-wf3")); | ||
|
||
var wf2 = new WorkflowGlobalTransaction(factory.Object, NullLoggerFactory.Instance); | ||
Assert.False(wf2.Exists("my-wf1")); | ||
Assert.False(wf2.Exists("my-wf2")); | ||
Assert.False(wf2.Exists("my-wf3")); | ||
} | ||
#endif | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters