-
Notifications
You must be signed in to change notification settings - Fork 13
/
TestSequenceTopology.cs
executable file
·55 lines (46 loc) · 1.4 KB
/
TestSequenceTopology.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
namespace Flow.Test
{
using NUnit.Framework;
[TestFixture]
public class TestSequences
: TestBase
{
[Test()]
public void TestSequence()
{
var stepNum = 0;
Root.Add(
New.Sequence(
New.Do(() => stepNum += Kernel.StepNumber),
New.Do(() => stepNum += Kernel.StepNumber),
New.Do(() => stepNum += Kernel.StepNumber),
New.Do(() => stepNum += Kernel.StepNumber),
New.Do(() => stepNum += Kernel.StepNumber)
)
);
Step(5);
Assert.AreEqual(stepNum, 0 + 1 + 2 + 3 + 4);
}
[Test]
public void TestEmptySequenceCompletes()
{
var completed = false;
var seq = New.Sequence().AddTo(Root);
seq.Completed += tr => completed = true;
Step(4);
Assert.IsTrue(completed);
}
[Test]
public void TestParallel()
{
var stepNum = 0;
New.Node(
New.Do(() => stepNum += 1).Named("Do 1"),
New.Do(() => stepNum += 1).Named("Do 2"),
New.Do(() => stepNum += 1).Named("Do 3")
).Named("Parallel Node").AddTo(Root);
Step(3);
Assert.AreEqual(3, stepNum);
}
}
}