Ejemplo n.º 1
0
        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);
            }
        }
Ejemplo n.º 2
0
        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);
            }
        }
Ejemplo n.º 3
0
        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);
            }
        }
Ejemplo n.º 4
0
        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);
            }
        }
Ejemplo n.º 5
0
        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);
            }
        }
Ejemplo n.º 6
0
        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);
            }
        }