public void TestFilter() { var e = new EventSink <char>(); var @out = new List <char>(); Listener l = e.Filter(c => Char.IsUpper((char)c)).Listen(c => { @out.Add(c); }); e.Send('H'); e.Send('o'); e.Send('I'); l.Unlisten(); CollectionAssert.AreEqual(new[] { 'H', 'I' }, @out); }
public void TestFilter() { var e = new EventSink<char>(); var @out = new List<char>(); Listener l = e.Filter(c => Char.IsUpper((char)c)).Listen(c => { @out.Add(c); }); e.Send('H'); e.Send('o'); e.Send('I'); l.Unlisten(); CollectionAssert.AreEqual(new[] { 'H', 'I' }, @out); }