Exemplo n.º 1
0
        public void MergeAll()
        {
            Observation <string> observerA = null;
            Observation <string> observerB = null;
            Observation <string> observerC = null;
            Observe <string>     a         = x => observerA = x;
            Observe <string>     b         = x => observerB = x;
            Observe <string>     c         = x => observerC = x;

            Observe.Merge(a, b, c).ToList()(
                result =>
            {
                var v = result.Value;
                Assert.AreEqual(4, v.Count);
                Assert.AreEqual("A0", v[0]);
                Assert.AreEqual("B0", v[1]);
                Assert.AreEqual("A1", v[2]);
                Assert.AreEqual("B1", v[3]);
            });

            observerA(new Some <string>("A0"));
            observerB(new Some <string>("B0"));
            observerA(new Some <string>("A1"));
            observerB(new Some <string>("B1"));
            observerC(new None <string>());
            observerB(new Some <string>("B2"));
        }