コード例 #1
0
        public void Lockstep()
        {
            var dp1 = new DirectProcessor <int>();
            var dp2 = new DirectProcessor <int>();

            TestSubscriber <int> ts = dp1.Sample(dp2).Test();

            ts.AssertEmpty();

            dp1.OnNext(1);
            dp1.OnNext(2);

            dp2.OnNext(100);

            ts.AssertValues(2);

            dp2.OnNext(100);

            ts.AssertValues(2);

            dp1.OnNext(3);
            dp1.OnNext(4);

            dp2.OnNext(200);

            ts.AssertValues(2, 4);

            dp2.OnComplete();

            ts.AssertResult(2, 4);

            Assert.IsFalse(dp1.HasSubscribers);
            Assert.IsFalse(dp2.HasSubscribers);
        }
コード例 #2
0
        public void ZipTest_DifferentLength()
        {
            TestSubscriber <int> ts = new TestSubscriber <int>();

            Flowable.Zip(Flowable.Range(1, 3), Flowable.Range(10, 2), (a, b) => a + b).Subscribe(ts);

            ts.AssertValues(11, 13)
            .AssertComplete()
            .AssertNoError();
        }