示例#1
0
        public void Concat()
        {
            Console.WriteLine(MethodBase.GetCurrentMethod().Name);

            var gen        = new InputGenerator();
            var definition = StandardOperators.Concat();

            using (var instance = ExpressionInstance.Create(definition))
            {
                var a = instance.GetInput("a");
                var b = instance.GetInput("b");

                b.OnNext2(gen.Next());
                b.OnNext2(gen.Next());
                a.OnNext2(gen.Next());
                a.OnNext2(gen.Next());
                a.OnNext2(gen.Next());
                b.OnNext2(gen.Next());
                a.OnCompleted2();
                b.OnNext2(gen.Next());
                b.OnNext2(gen.Next());
                b.OnCompleted2();

                AddDiagram("Concat", instance.Diagram);
            }
        }
示例#2
0
        public void BufferWithTime()
        {
            Console.WriteLine(MethodBase.GetCurrentMethod().Name);

            var gen        = new InputGenerator();
            var definition = StandardOperators.BufferWithTime();

            using (var instance = ExpressionInstance.Create(definition))
            {
                var a = instance.GetInput("a");

                Thread.Sleep(100);
                a.OnNext2(gen.Next());
                a.OnNext2(gen.Next());
                a.OnNext2(gen.Next());
                Thread.Sleep(3000);
                a.OnNext2(gen.Next());
                a.OnNext2(gen.Next());
                a.OnCompleted2();

                AddDiagram("BufferWithTime", instance.Diagram);
            }
        }
示例#3
0
        public void Amb()
        {
            Console.WriteLine(MethodBase.GetCurrentMethod().Name);

            var gen = new InputGenerator();
            var definition = StandardOperators.Amb();

            using (var instance = ExpressionInstance.Create(definition))
            {
                var a = instance.GetInput("a");
                var b = instance.GetInput("b");

                a.OnNext2(gen.Next());
                b.OnNext2(gen.Next());
                b.OnNext2(gen.Next());
                a.OnNext2(gen.Next());
                b.OnNext2(gen.Next());
                a.OnNext2(gen.Next());
                b.OnNext2(gen.Next());
                b.OnCompleted2();
                a.OnCompleted2();

                AddDiagram("Amb", instance.Diagram);
            }
        }
示例#4
0
        public void BufferWithTime()
        {
            Console.WriteLine(MethodBase.GetCurrentMethod().Name);

            var gen = new InputGenerator();
            var definition = StandardOperators.BufferWithTime();

            using (var instance = ExpressionInstance.Create(definition))
            {
                var a = instance.GetInput("a");

                Thread.Sleep(100);
                a.OnNext2(gen.Next());
                a.OnNext2(gen.Next());
                a.OnNext2(gen.Next());
                Thread.Sleep(3000);
                a.OnNext2(gen.Next());
                a.OnNext2(gen.Next());
                a.OnCompleted2();

                AddDiagram("BufferWithTime", instance.Diagram);
            }
        }