Exemple #1
0
        public void RedundantBind_Throw()
        {
            Action <Cat>  method = o => Assert.Fail();
            ContentPusher pusher = new ContentPusher();

            pusher.Bind(method);
            pusher.Bind(method);
        }
Exemple #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());
        }
Exemple #3
0
        public void Deritive_Throw()
        {
            ContentPusher pusher = new ContentPusher();

            pusher.Bind <Cat>(o => { Assert.Fail(); });
            pusher.Push(new Animal {
                TestProp1 = 3
            });
        }
Exemple #4
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);
        }
Exemple #5
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);
        }