Ejemplo n.º 1
0
        public void Deritive_Throw()
        {
            ContentPusher pusher = new ContentPusher();

            pusher.Bind <Cat>(o => { Assert.Fail(); });
            pusher.Push(new Animal {
                TestProp1 = 3
            });
        }
Ejemplo n.º 2
0
        public void Unbind_Throw()
        {
            Action <Cat>  method = o => Assert.Fail();
            ContentPusher pusher = new ContentPusher();

            pusher.Bind(method);
            pusher.Unbind(method);
            pusher.Push(new Cat());
        }
Ejemplo n.º 3
0
        public void MultipleSubscribersUnbind_Assert()
        {
            bool          a1Raised = false;
            Action <Cat>  action1  = delegate { a1Raised = true; };
            Action <Cat>  action2  = delegate { };
            ContentPusher pusher   = new ContentPusher();

            pusher.Bind(action1);
            pusher.Bind(action2);
            pusher.Unbind(action2);
            pusher.Push(new Cat());
            Assert.IsTrue(a1Raised);
        }
Ejemplo n.º 4
0
        public void BasicBindPush_Assert()
        {
            ContentPusher pusher = new ContentPusher();
            bool          fired  = false;
            int           val    = 0;

            pusher.Bind <Animal>(o =>
            {
                fired = true;
                val   = o.TestProp1;
            });

            pusher.Push(new Animal {
                TestProp1 = 3
            });

            Assert.IsTrue(fired && val == 3);
        }