コード例 #1
0
        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);
        }
コード例 #2
0
 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);
 }