Exemple #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);
            }
        }
Exemple #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);
            }
        }
Exemple #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);
            }
        }
        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);
            }
        }
Exemple #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);
            }
        }
Exemple #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);
            }
        }
        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);
            }
        }
        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);
            }
        }
        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);
            }
        }
        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);
            }
        }