Beispiel #1
0
        public void CombineLatest()
        {
            Console.WriteLine(MethodBase.GetCurrentMethod().Name);

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

            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());
                b.OnNext2(gen.Next());
                a.OnNext2(gen.Next());
                b.OnNext2(gen.Next());
                a.OnCompleted2();
                b.OnNext2(gen.Next());
                b.OnCompleted2();

                AddDiagram("CombineLatest", instance.Diagram);
            }
        }
Beispiel #2
0
        public void GroupBy()
        {
            Console.WriteLine(MethodBase.GetCurrentMethod().Name);

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

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

                a.OnNext2("a");
                a.OnNext2("a");
                a.OnNext2("aa");
                a.OnNext2("aaa");
                a.OnNext2("aaa");
                a.OnNext2("aa");
                a.OnNext2("a");
                a.OnNext2("a");
                a.OnNext2("a");
                a.OnCompleted2();

                AddDiagram("GroupBy", instance.Diagram);
            }
        }
Beispiel #3
0
        public void SelectMany()
        {
            Console.WriteLine(MethodBase.GetCurrentMethod().Name);

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

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

                a.OnNext2("2");
                a.OnCompleted2();

                Thread.Sleep(3000);

                AddDiagram("SelectMany", instance.Diagram);
            }
        }
Beispiel #4
0
        public void All()
        {
            Console.WriteLine(MethodBase.GetCurrentMethod().Name);

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

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

                a.OnNext2("a");
                a.OnNext2("aa");
                a.OnNext2("aaa");
                a.OnNext2("aaaa");
                a.OnCompleted2();

                AddDiagram("All", instance.Diagram);
            }
        }
Beispiel #5
0
        public void Throttle()
        {
            Console.WriteLine(MethodBase.GetCurrentMethod().Name);

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

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

                a.OnNext2(DateTime.Now.ToString("F"));
                a.OnNext2(DateTime.Now.ToString("F"));
                Thread.Sleep(3000);
                a.OnNext2(DateTime.Now.ToString("F"));
                a.OnNext2(DateTime.Now.ToString("F"));
                a.OnCompleted2();

                AddDiagram("Throttle", instance.Diagram);
            }
        }
Beispiel #6
0
        public void BufferWithCount()
        {
            Console.WriteLine(MethodBase.GetCurrentMethod().Name);

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

            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());
                a.OnNext2(gen.Next());
                a.OnNext2(gen.Next());
                a.OnNext2(gen.Next());
                a.OnNext2(gen.Next());
                a.OnCompleted2();

                AddDiagram("BufferWithCount", instance.Diagram);
            }
        }
Beispiel #7
0
        public void Throttle()
        {
            Console.WriteLine(MethodBase.GetCurrentMethod().Name);

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

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

                a.OnNext2(DateTime.Now.ToString("F"));
                a.OnNext2(DateTime.Now.ToString("F"));
                Thread.Sleep(3000);
                a.OnNext2(DateTime.Now.ToString("F"));
                a.OnNext2(DateTime.Now.ToString("F"));
                a.OnCompleted2();

                AddDiagram("Throttle", instance.Diagram);
            }
        }
Beispiel #8
0
        public void SelectMany()
        {
            Console.WriteLine(MethodBase.GetCurrentMethod().Name);

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

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

                a.OnNext2("2");
                a.OnCompleted2();

                Thread.Sleep(3000);

                AddDiagram("SelectMany", instance.Diagram);
            }
        }
Beispiel #9
0
        public void OnErrorResumeNext()
        {
            Console.WriteLine(MethodBase.GetCurrentMethod().Name);

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

            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());
                a.OnCompleted2();
                b.OnNext2(gen.Next());
                b.OnNext2(gen.Next());

                AddDiagram("OnErrorResumeNext", instance.Diagram);
            }
        }
Beispiel #10
0
        public void BufferWithCount()
        {
            Console.WriteLine(MethodBase.GetCurrentMethod().Name);

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

            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());
                a.OnNext2(gen.Next());
                a.OnNext2(gen.Next());
                a.OnNext2(gen.Next());
                a.OnNext2(gen.Next());
                a.OnCompleted2();

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