示例#1
0
        public void CheckFlowWithSwitch()
        {
            // Arrange
            var b = new FlowBuilder();

            var s  = b.SwitchOf <int>();
            var a1 = b.DummyActivity();
            var a2 = b.DummyActivity();
            var a3 = b.DummyActivity();

            b.WithInitialNode(s);
            s.ConnectCase(0).To(a1);
            s.ConnectCase(1).To(a2);
            s.ConnectDefaultTo(a3);

            var e = b.DummyActivity();

            var validator = new ReachabilityValidator();

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

            // Assert
            Assert.That(result.GetErrorsOf(s), Is.Empty);
            Assert.That(result.GetErrorsOf(a1), Is.Empty);
            Assert.That(result.GetErrorsOf(a2), Is.Empty);
            Assert.That(result.GetErrorsOf(a3), Is.Empty);
            Assert.That(result.GetErrorsOf(e), Is.Not.Empty);
        }
示例#2
0
        public void CheckFlowWithActivity()
        {
            // Arrange
            var b  = new FlowBuilder();
            var a1 = b.DummyActivity();
            var a2 = b.DummyActivity();

            b.WithInitialNode(a1);

            var validator = new ReachabilityValidator();

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

            // Assert
            Assert.That(result.GetErrorsOf(a1), Is.Empty);
            Assert.That(result.GetErrorsOf(a2), Is.Not.Empty);
        }
示例#3
0
        protected override void Build(FlowBuilder builder)
        {
            builder.WithDefaultFaultHandler <MyFaultHandler>();
            builder.WithDefaultCancellationHandler <MyCancellationHandler>();

            var act1 = builder.DummyActivity();
            var act2 = builder.Activity <ThrowActivity>("Throw activity");

            act1.ConnectTo(act2);

            builder.WithInitialNode(act1);
        }
示例#4
0
        public void CheckFlowWithCondition()
        {
            // Arrange
            var b = new FlowBuilder();

            var c = b.Condition();
            var a = b.DummyActivity();

            b.WithInitialNode(c);
            c.ConnectFalseTo(a).ConnectTrueTo(a);

            var e = b.DummyActivity();

            var validator = new ReachabilityValidator();

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

            // Assert
            Assert.That(result.GetErrorsOf(c), Is.Empty);
            Assert.That(result.GetErrorsOf(a), Is.Empty);
            Assert.That(result.GetErrorsOf(e), Is.Not.Empty);
        }
示例#5
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));
        }