Beispiel #1
0
        public void Zip5()
        {
            var subj1 = new Subject <int>();
            var subj2 = new Subject <int>();
            var subj3 = new Subject <int>();
            var subj4 = new Subject <int>();
            var subj5 = new Subject <int>();
            var obs   = subj1.zip(subj2, subj3, subj4, subj5);
            var t     = obs.pipeToRef();
            var r     = t._1;

            subj1.push(1);
            r.value.shouldBeNone();
            subj2.push(1);
            r.value.shouldBeNone();
            subj3.push(1);
            r.value.shouldBeNone();
            subj4.push(1);
            r.value.shouldBeNone();
            subj5.push(1);
            r.value.shouldBeSome(F.t(1, 1, 1, 1, 1));
            subj2.push(2);
            r.value.shouldBeSome(F.t(1, 2, 1, 1, 1));
            subj3.push(0);
            r.value.shouldBeSome(F.t(1, 2, 0, 1, 1));
            subj1.push(3);
            r.value.shouldBeSome(F.t(3, 2, 0, 1, 1));
            subj4.push(5);
            r.value.shouldBeSome(F.t(3, 2, 0, 5, 1));
            subj5.push(6);
            r.value.shouldBeSome(F.t(3, 2, 0, 5, 6));

            IObservableTestExts.testUnsubAndFinish(t._2, obs, subj1, subj2, subj3, subj4, subj5);
        }
Beispiel #2
0
 public void TestCustomCollection()
 {
     IObservableTestExts.observableCreateListQueue <int>(queue => test(
                                                             subj => subj.buffer(3, queue),
                                                             args => args
                                                             ));
 }
Beispiel #3
0
        public void WithCustomEq()
        {
            var subj  = new Subject <int>();
            var elems = new[] { 1, 1, 2, 2, 3, 3, 4, 4 };
            var obs   = subj.changedValues((a, b) => false);
            var t     = obs.pipeToList();

            subj.pushMany(elems);
            t._1.shouldEqual(elems.ToList());

            IObservableTestExts.testUnsubAndFinish(t._2, obs, subj);
        }
Beispiel #4
0
        public void WithDefaultEq()
        {
            var subj = new Subject <int>();
            var obs  = subj.changes();
            var t    = obs.pipeToList();

            subj.pushMany(1, 1, 2, 2, 3, 3, 4, 4);
            t._1.shouldEqual(F.list(
                                 F.t(1, 2), F.t(2, 3), F.t(3, 4)
                                 ));

            IObservableTestExts.testUnsubAndFinish(t._2, obs, subj);
        }
Beispiel #5
0
        public void Test()
        {
            var subj1 = new Subject <int>();
            var subj2 = new Subject <int>();
            var obs   = subj1.joinDiscard(subj2);
            var t     = obs.countEvents();
            var evts  = t._1;

            subj1.pushMany(1, 2, 3);
            subj2.pushMany(1, 2, 3);
            evts.value.shouldEqual(6u);

            IObservableTestExts.testUnsubAndFinish(t._2, obs, subj1, subj2);
        }
Beispiel #6
0
        public void WithDefaultEq()
        {
            var subj = new Subject <int>();
            var obs  = subj.changesOpt();
            var t    = obs.pipeToList();
            var list = t._1;

            subj.pushMany(1, 1, 2, 2, 3, 3);
            list.shouldEqual(F.list(
                                 F.t(Option <int> .None, 1),
                                 F.t(1.some(), 2),
                                 F.t(2.some(), 3)
                                 ));

            IObservableTestExts.testUnsubAndFinish(t._2, obs, subj);
        }
Beispiel #7
0
        public void Zip2()
        {
            var subj1 = new Subject <int>();
            var subj2 = new Subject <int>();
            var obs   = subj1.zip(subj2);
            var t     = obs.pipeToRef();
            var r     = t._1;

            subj1.push(1);
            r.value.shouldBeNone();
            subj2.push(1);
            r.value.shouldBeSome(F.t(1, 1));
            subj2.push(2);
            r.value.shouldBeSome(F.t(1, 2));
            subj1.push(0);
            r.value.shouldBeSome(F.t(0, 2));

            IObservableTestExts.testUnsubAndFinish(t._2, obs, subj1, subj2);
        }
Beispiel #8
0
        public void WithCustomEq()
        {
            var subj = new Subject <int>();
            var obs  = subj.changesOpt((a, b) => false);
            var t    = obs.pipeToList();
            var list = t._1;

            subj.pushMany(1, 1, 3, 3, 2, 2, 4, 4, 5, 5);
            list.shouldEqual(F.list(
                                 F.t(Option <int> .None, 1),
                                 F.t(1.some(), 1),
                                 F.t(1.some(), 3),
                                 F.t(3.some(), 3),
                                 F.t(3.some(), 2),
                                 F.t(2.some(), 2),
                                 F.t(2.some(), 4),
                                 F.t(4.some(), 4),
                                 F.t(4.some(), 5),
                                 F.t(5.some(), 5)
                                 ));

            IObservableTestExts.testUnsubAndFinish(t._2, obs, subj);
        }