コード例 #1
0
        public void Should_notify_when_left_right_received()
        {
            var left = new Subject<int>();
            var right = new Subject<int>();

            var withLatest = left.WithLatest(right, (l, r) => l + r);
            var received = new List<int>();
            using (withLatest.Subscribe(i => received.Add(i)))
            {
                left.OnNext(1);
                right.OnNext(1);

                Assert.AreEqual(1, received.Count);
                Assert.AreEqual(2, received[0]);
            }
        }