コード例 #1
0
        public void CheckFlowWithBlock()
        {
            // Arrange
            var b = new FlowBuilder();

            IFlowNode a = null;
            IFlowNode e = null;

            var block = b.Block("test", (_, builder) =>
            {
                a = builder.DummyActivity();
                e = builder.DummyActivity();
            });

            b.WithInitialNode(block);

            var validator = new ReachabilityValidator();

            // Act
            validator.Validate(b.CreateFlow());
            var result = validator.Result;

            // Assert
            Assert.That(result.GetErrorsOf(block), Is.Empty);
            Assert.That(result.GetErrorsOf(a), Is.Empty);
            Assert.That(result.GetErrorsOf(e), Is.Not.Empty);
        }
コード例 #2
0
        public void RunCase(
            Action <FlowBuilder, IFlowNode> createInnerAndConnectToOuter,
            int errorsCount)
        {
            // Arrange
            var builder = new FlowBuilder();
            var a       = builder.DummyActivity();

            var block = builder.Block("test", (_, b) => { createInnerAndConnectToOuter(b, a); });

            var validator = new BlockSelfContainednessValidator(block, null, null);

            // Act
            validator.Validate();

            // Assert
            Assert.That(validator.Result.GetErrorsOf(a).Count(), Is.EqualTo(errorsCount));
        }
コード例 #3
0
ファイル: Flow3.cs プロジェクト: workflow-group/MicroFlow
        protected override void Build(FlowBuilder builder)
        {
            builder.WithDefaultFaultHandler <MyFaultHandler>();
            builder.WithDefaultCancellationHandler <MyCancellationHandler>();

            var var = builder.Variable <int>();

            var block = builder.Block("MyBlock", (thisBlock, blockBuilder) =>
            {
                var activity = blockBuilder.Activity <ReadIntActivity>("Input number");
                var.BindToResultOf(activity);
            });

            var outputActivity = builder.Activity <WriteMessageActivity>("Output activity");

            outputActivity.Bind(x => x.Message).To(() => $"Echo: {var.CurrentValue}");

            builder.WithInitialNode(block);
            block.ConnectTo(outputActivity);
        }
コード例 #4
0
        private static BlockNode BuildBlock(Action <FlowBuilder> buildAction)
        {
            var b = new FlowBuilder();

            return(b.Block("1", (thisBlock, builder) => buildAction(builder)));
        }