Esempio n. 1
0
        public void TestChannelInterface()
        {
            wise.Detail.Channel channel = new wise.Detail.Channel();

            var mt = new MessageTest();
            var tk = channel.Subscribe(mt, mt.OnMessage);

            channel.Post(mt);
            Assert.IsTrue(mt.value == 4);

            channel.Post(mt);
            Assert.IsTrue(mt.value == 5); // posted

            var rc = channel.Unsubscribe(tk);

            Assert.IsTrue(rc); // unsubscribed

            channel.Post(mt);
            Assert.IsTrue(mt.value == 5); // not posted
        }
Esempio n. 2
0
 public void OnMessage(MessageTest m)
 {
     ++value;
 }