Example #1
0
        public void AttachEventCorrectly()
        {
            var obj     = new TestEventClass();
            var wrapper = new ImplBaseTester(obj);

            wrapper.AddEvent <EventArgs>(nameof(TestEventClass.Event), nameof(ImplBaseTester.HandleEvent));
            obj.FireEvent();
            Assert.IsTrue(wrapper.EventCalled);
        }
Example #2
0
        public void DetachEventCorrectly()
        {
            var obj     = new TestEventClass();
            var wrapper = new ImplBaseTester(obj);

            obj.Event += wrapper.HandleEvent;
            wrapper.RemoveEvent <EventArgs>(nameof(TestEventClass.Event), nameof(ImplBaseTester.HandleEvent));
            obj.FireEvent();
            Assert.IsFalse(wrapper.EventCalled);
        }