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(); }
public void Run() { CellSink<int> x = new CellSink<int>(0); using (x.Listen(Console.WriteLine)) { x.Send(10); x.Send(20); x.Send(30); } }
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); }
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); }
public void Run() { CellSink <int> x = new CellSink <int>(0); using (x.Listen(Console.WriteLine)) { x.Send(10); x.Send(20); x.Send(30); } }
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); }
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); }