public void Run() { DiscreteCellSink <int> x = new DiscreteCellSink <int>(0); IListener l = x.Listen(Console.WriteLine); x.Send(10); x.Send(20); x.Send(30); l.Unlisten(); }
public void TestListen() { DiscreteCellSink <int> c = DiscreteCell.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); }