Exemple #1
0
        public void UnicastProcessor_Online_Fused_Scheduled_5()
        {
            for (int i = 0; i < 10000; i++)
            {
                var up = new UnicastProcessor <int>();

                var ts = new TestSubscriber <int>(fusionMode: FuseableHelper.ANY);

                int[] wait = { 2 };

                Task.Run(() =>
                {
                    up.OnNext(1, 2);
                    up.OnNext(3, 4);
                    up.OnNext(5, 6);

                    Interlocked.Decrement(ref wait[0]);
                    while (Volatile.Read(ref wait[0]) != 0)
                    {
                        ;
                    }

                    up.OnComplete();
                });

                Interlocked.Decrement(ref wait[0]);
                while (Volatile.Read(ref wait[0]) != 0)
                {
                    ;
                }

                up.Subscribe(ts);

                ts
                .AwaitTerminalEvent(TimeSpan.FromSeconds(5))
                .AssertResult(1, 2, 3, 4, 5, 6);
            }
        }