Exemple #1
0
            public void Run()
            {
                CellSink <int> x = Cell.CreateSink(0);
                IListener      l = x.Listen(Console.WriteLine);

                x.Send(10);
                x.Send(20);
                x.Send(30);
                l.Unlisten();
            }
Exemple #2
0
 public void Run()
 {
     CellSink<int> x = new CellSink<int>(0);
     using (x.Listen(Console.WriteLine))
     {
         x.Send(10);
         x.Send(20);
         x.Send(30);
     }
 }
Exemple #3
0
        public void TestListen()
        {
            CellSink <int> c    = Cell.CreateSink(9);
            List <int>     @out = new List <int>();
            IListener      l    = c.Listen(@out.Add);

            c.Send(2);
            c.Send(7);
            l.Unlisten();
            CollectionAssert.AreEqual(new[] { 9, 2, 7 }, @out);
        }
Exemple #4
0
 public void TestListen()
 {
     CellSink<int> c = new CellSink<int>(9);
     List<int> @out = new List<int>();
     using (c.Listen(@out.Add))
     {
         c.Send(2);
         c.Send(7);
     }
     CollectionAssert.AreEqual(new[] { 9, 2, 7 }, @out);
 }
Exemple #5
0
            public void Run()
            {
                CellSink <int> x = new CellSink <int>(0);

                using (x.Listen(Console.WriteLine))
                {
                    x.Send(10);
                    x.Send(20);
                    x.Send(30);
                }
            }
Exemple #6
0
        public void TestListen()
        {
            CellSink <int> c    = new CellSink <int>(9);
            List <int>     @out = new List <int>();

            using (c.Listen(@out.Add))
            {
                c.Send(2);
                c.Send(7);
            }
            CollectionAssert.AreEqual(new[] { 9, 2, 7 }, @out);
        }
Exemple #7
0
        public void TestSendNull()
        {
            CellSink <string> c    = new CellSink <string>(string.Empty);
            List <string>     @out = new List <string>();
            IListener         l    = c.Listen(@out.Add);

            c.Send("0");
            c.Send(null);
            c.Send("1");
            l.Unlisten();
            CollectionAssert.AreEqual(new[] { string.Empty, "0", null, "1" }, @out);
        }