Exemple #1
0
        public void OneWorkTest()
        {
            _testState = 0;

            var graph = new WorkflowGraph()
            {
                new Work(0, new IStateItem[] { new FakeStateItem(0, 0) }),
            };

            graph.RunParallel(_context);

            graph.OfType <Work>()
            .All(x => x.StateItems.OfType <FakeStateItem>().First().IsDone)
            .Should().BeTrue();
        }
Exemple #2
0
        public void TwoDependencyTest()
        {
            _testState  = -1;
            _traceQueue = new ConcurrentQueue <int>();

            var graph = new WorkflowGraph()
            {
                new Work(0, new IStateItem[] { new FakeStateItem(-1, 0) }),
                new Work(1, new IStateItem[] { new FakeStateItem(0, 1) }),
                new DirectedEdge(0, 1),
            };

            graph.RunParallel(_context);

            graph.OfType <Work>()
            .All(x => x.StateItems.OfType <FakeStateItem>().First().IsDone)
            .Should().BeTrue();

            _testState.Should().Be(1);
        }