-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added in additional testing for handling sub processes
- Loading branch information
1 parent
a48dd9c
commit 4506423
Showing
17 changed files
with
433 additions
and
42 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
-777 Bytes
(100%)
BPMNEngine/.vs/ProjectEvaluation/bpmnengine.metadata.v7.bin
Binary file not shown.
Binary file modified
BIN
+1.01 MB
(110%)
BPMNEngine/.vs/ProjectEvaluation/bpmnengine.projects.v7.bin
Binary file not shown.
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
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
[assembly: Parallelize(Workers = 50, Scope = ExecutionScope.MethodLevel)] | ||
[assembly: Parallelize(Workers = 25, Scope = ExecutionScope.MethodLevel)] |
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,122 @@ | ||
using BPMNEngine; | ||
using BPMNEngine.Interfaces.Tasks; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
namespace UnitTest | ||
{ | ||
[TestClass] | ||
public class SubProcesses | ||
{ | ||
private const string SIGNAL = "interupted"; | ||
|
||
private const string SUB_PROCESS_ID = "Activity_01eulv2"; | ||
private const string SUB_SUB_PROCESS_ID = "Activity_099a0io"; | ||
|
||
private const string MAIN_SIGNAL_ID = "Event_167oagf"; | ||
private const string SUB_SIGNAL_ID = "Event_1etf3o8"; | ||
private const string SUB_SUB_SIGNAL_ID = "Event_0s8bx7i"; | ||
|
||
private const string MAIN_TASK_ID = "Activity_1hle9w5"; | ||
private const string SUB_TASK_ID = "Activity_1ifnuk7"; | ||
private const string SUB_SUB_TASK_ID = "Activity_1e0arlx"; | ||
|
||
private static BusinessProcess _process; | ||
|
||
[ClassInitialize()] | ||
public static void Initialize(TestContext testContext) | ||
{ | ||
_process = new BusinessProcess(Utility.LoadResourceDocument("SubProcesses/subprocesses.bpmn")); | ||
} | ||
|
||
[ClassCleanup] | ||
public static void Cleanup() | ||
{ | ||
_process.Dispose(); | ||
} | ||
|
||
[TestMethod] | ||
public void TestSubProcessCompletion() | ||
{ | ||
var instance = _process.BeginProcess(); | ||
Assert.IsNotNull(instance); | ||
Assert.IsTrue(instance.WaitForManualTask(SUB_TASK_ID, out IManualTask task)); | ||
Assert.IsNotNull(task); | ||
task.MarkComplete(); | ||
Assert.IsTrue(Utility.WaitForCompletion(instance)); | ||
var state = instance.CurrentState; | ||
Assert.IsTrue(Utility.StepCompleted(state, SUB_PROCESS_ID)); | ||
Assert.IsTrue(Utility.StepAborted(state, SUB_SUB_PROCESS_ID)); | ||
Assert.IsTrue(Utility.StepAborted(state, SUB_SUB_TASK_ID)); | ||
} | ||
|
||
[TestMethod] | ||
public void TestSubTaskSignal() | ||
{ | ||
var instance = _process.BeginProcess(); | ||
Assert.IsNotNull(instance); | ||
Assert.IsTrue(instance.WaitForManualTask(SUB_TASK_ID, out IManualTask task)); | ||
Assert.IsNotNull(task); | ||
task.Signal(SIGNAL, out bool isAborted); | ||
Assert.IsTrue(isAborted); | ||
Assert.IsTrue(Utility.WaitForCompletion(instance)); | ||
var state = instance.CurrentState; | ||
Assert.IsTrue(Utility.StepAborted(state, SUB_PROCESS_ID)); | ||
Assert.IsTrue(Utility.StepCompleted(state, SUB_SIGNAL_ID)); | ||
Assert.IsFalse(Utility.StepCompleted(state, SUB_SUB_SIGNAL_ID)); | ||
Assert.IsFalse(Utility.StepCompleted(state, MAIN_SIGNAL_ID)); | ||
Assert.IsTrue(Utility.StepAborted(state, SUB_SUB_PROCESS_ID)); | ||
Assert.IsTrue(Utility.StepAborted(state, SUB_PROCESS_ID)); | ||
} | ||
|
||
[TestMethod] | ||
public void TestSubSubProcessCompletion() | ||
{ | ||
var instance = _process.BeginProcess(); | ||
Assert.IsNotNull(instance); | ||
Assert.IsTrue(instance.WaitForManualTask(SUB_SUB_TASK_ID, out IManualTask task)); | ||
Assert.IsNotNull(task); | ||
task.MarkComplete(); | ||
Assert.IsTrue(Utility.WaitForCompletion(instance)); | ||
var state = instance.CurrentState; | ||
Assert.IsTrue(Utility.StepCompleted(state, SUB_PROCESS_ID)); | ||
Assert.IsTrue(Utility.StepCompleted(state, SUB_SUB_PROCESS_ID)); | ||
Assert.IsTrue(Utility.StepAborted(state, SUB_TASK_ID)); | ||
} | ||
|
||
[TestMethod] | ||
public void TestSubSubTaskSignal() | ||
{ | ||
var instance = _process.BeginProcess(); | ||
Assert.IsNotNull(instance); | ||
Assert.IsTrue(instance.WaitForManualTask(SUB_SUB_TASK_ID, out IManualTask task)); | ||
Assert.IsNotNull(task); | ||
task.Signal(SIGNAL,out bool isAborted); | ||
Assert.IsTrue(isAborted); | ||
Assert.IsTrue(Utility.WaitForCompletion(instance)); | ||
var state = instance.CurrentState; | ||
Assert.IsTrue(Utility.StepCompleted(state, SUB_PROCESS_ID)); | ||
Assert.IsTrue(Utility.StepCompleted(state, SUB_SUB_SIGNAL_ID)); | ||
Assert.IsFalse(Utility.StepCompleted(state, SUB_SIGNAL_ID)); | ||
Assert.IsFalse(Utility.StepCompleted(state, MAIN_SIGNAL_ID)); | ||
Assert.IsTrue(Utility.StepAborted(state, SUB_SUB_PROCESS_ID)); | ||
Assert.IsTrue(Utility.StepAborted(state, SUB_SUB_TASK_ID)); | ||
} | ||
|
||
[TestMethod] | ||
public void TestMainTaskSignal() | ||
{ | ||
var instance = _process.BeginProcess(); | ||
Assert.IsNotNull(instance); | ||
Assert.IsTrue(instance.WaitForManualTask(MAIN_TASK_ID, out IManualTask task)); | ||
Assert.IsNotNull(task); | ||
task.Signal(SIGNAL, out bool isAborted); | ||
Assert.IsFalse(isAborted); | ||
Assert.IsTrue(Utility.WaitForCompletion(instance)); | ||
var state = instance.CurrentState; | ||
Assert.IsFalse(Utility.StepCompleted(state, SUB_PROCESS_ID)); | ||
Assert.IsFalse(Utility.StepCompleted(state, SUB_SUB_SIGNAL_ID)); | ||
Assert.IsFalse(Utility.StepCompleted(state, SUB_SIGNAL_ID)); | ||
Assert.IsTrue(Utility.StepCompleted(state, MAIN_SIGNAL_ID)); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.