Example #1
0
        public async Task TestListenOnceAsync()
        {
            CellSink <int> c      = Cell.CreateSink(9);
            int            result = await Transaction.Run(() => c.Values().ListenOnceAsync());

            c.Send(2);
            c.Send(7);
            Assert.AreEqual(9, result);
        }
Example #2
0
            public void Run()
            {
                CellSink <int> x = Cell.CreateSink(0);

                x.Send(1);
                IListener l = Transaction.Run(() => x.Values().Listen(Console.WriteLine));

                x.Send(2);
                x.Send(3);
                l.Unlisten();
            }
Example #3
0
        public void TestListenOnce()
        {
            CellSink <int> c    = Cell.CreateSink(9);
            List <int>     @out = new List <int>();
            IListener      l    = Transaction.Run(() => c.Values().ListenOnce(@out.Add));

            c.Send(2);
            c.Send(7);
            l.Unlisten();
            CollectionAssert.AreEqual(new[] { 9 }, @out);
        }