コード例 #1
0
ファイル: test_EBC.cs プロジェクト: kennychou0529/NPantaRhei
        public void Active_EBC_fires_in_flow()
        {
            var ebc = new ActiveEbc();

            var config = new FlowRuntimeConfiguration()
                                .AddStreamsFrom(@"
                                                    /
                                                    .in, subflow.in
                                                    subflow.out, .out

                                                    subflow
                                                    .in, ebc.Run
                                                    ebc.Out, .out
                                                 ")
                                .AddEventBasedComponent("ebc", ebc);

            using (var fr = new FlowRuntime(config))
            {
                fr.Process(".in", "hello");

                var result = "";
                Assert.IsTrue(fr.WaitForResult(2000, _ => result = (string)_.Data));
                Assert.AreEqual("hellox", result);
            }
        }
コード例 #2
0
ファイル: test_EBC.cs プロジェクト: kouweizhong/NPantaRhei
        public void Active_EBC_fires_in_flow()
        {
            var ebc = new ActiveEbc();

            var config = new FlowRuntimeConfiguration()
                         .AddStreamsFrom(@"
                                                    /
                                                    .in, subflow.in
                                                    subflow.out, .out

                                                    subflow
                                                    .in, ebc.Run
                                                    ebc.Out, .out
                                                 ")
                         .AddEventBasedComponent("ebc", ebc);

            using (var fr = new FlowRuntime(config))
            {
                fr.Process(".in", "hello");

                var result = "";
                Assert.IsTrue(fr.WaitForResult(2000, _ => result = (string)_.Data));
                Assert.AreEqual("hellox", result);
            }
        }
コード例 #3
0
ファイル: test_EBC.cs プロジェクト: kennychou0529/NPantaRhei
        public void Active_EBC_fires_independently()
        {
            var ebc = new ActiveEbc();

            var config = new FlowRuntimeConfiguration()
                                .AddStreamsFrom(@"
                                                    /
                                                    ebc.Out, .out
                                                 ")
                                .AddEventBasedComponent("ebc", ebc);

            using(var fr = new FlowRuntime(config))
            {
                ebc.Run("hello");

                var result = "";
                Assert.IsTrue(fr.WaitForResult(1000, _ => result = (string) _.Data));
                Assert.AreEqual("hellox", result);
            }
        }
コード例 #4
0
ファイル: test_EBC.cs プロジェクト: kouweizhong/NPantaRhei
        public void Active_EBC_fires_independently()
        {
            var ebc = new ActiveEbc();

            var config = new FlowRuntimeConfiguration()
                         .AddStreamsFrom(@"
                                                    /
                                                    ebc.Out, .out
                                                 ")
                         .AddEventBasedComponent("ebc", ebc);

            using (var fr = new FlowRuntime(config))
            {
                ebc.Run("hello");

                var result = "";
                Assert.IsTrue(fr.WaitForResult(1000, _ => result = (string)_.Data));
                Assert.AreEqual("hellox", result);
            }
        }
コード例 #5
0
ファイル: test_EBC.cs プロジェクト: kouweizhong/NPantaRhei
        public void An_active_ebc_fires_an_event_before_another_ebc_receives()
        {
            var ebc1 = new ActiveEbc();

            var config = new FlowRuntimeConfiguration()
                         .AddStreamsFrom(@"
                                                    /
                                                    ebc1.Out, ebc2.Run
                                                    ebc2.Out, .out
                                                 ")
                         .AddEventBasedComponent("ebc1", ebc1)
                         .AddEventBasedComponent("ebc2", new ActiveEbc());

            using (var fr = new FlowRuntime(config))
            {
                ebc1.Run("hello");

                var result = "";
                Assert.IsTrue(fr.WaitForResult(2000, _ => result = (string)_.Data));
                Assert.AreEqual("helloxx", result);
            }
        }
コード例 #6
0
ファイル: test_EBC.cs プロジェクト: kennychou0529/NPantaRhei
        public void An_active_ebc_fires_an_event_before_another_ebc_receives()
        {
            var ebc1 = new ActiveEbc();

            var config = new FlowRuntimeConfiguration()
                                .AddStreamsFrom(@"
                                                    /
                                                    ebc1.Out, ebc2.Run
                                                    ebc2.Out, .out
                                                 ")
                                .AddEventBasedComponent("ebc1", ebc1)
                                .AddEventBasedComponent("ebc2", new ActiveEbc());

            using (var fr = new FlowRuntime(config))
            {
                ebc1.Run("hello");

                var result = "";
                Assert.IsTrue(fr.WaitForResult(2000, _ => result = (string)_.Data));
                Assert.AreEqual("helloxx", result);
            }
        }