public void RemovingNonExistentHandlersShouldNotThrow()
        {
            var wem = new WeakEventManager();

            wem.RemoveEventHandler((sender, args) => { }, "fake");
            wem.RemoveEventHandler(Handler, "alsofake");
        }
示例#2
0
        public void AddEventHandler()
        {
            tlog.Debug(tag, $"AddEventHandler START");
            try
            {
                var testingTarget = new WeakEventManager();
                visibilityChangedEventHandler = (o, e) => { };
                Assert.IsNotNull(testingTarget, "Can't create success object WeakEventManager.");
                testingTarget.AddEventHandler <VisibilityChangedEventArgs>("visibilityChangedEventHandler", visibilityChangedEventHandler);

                eventHandler = (o, e) => { };
                testingTarget.AddEventHandler("eventHandler", eventHandler);
                testingTarget.RemoveEventHandler <VisibilityChangedEventArgs>("visibilityChangedEventHandler", visibilityChangedEventHandler);
                testingTarget.RemoveEventHandler("eventHandler", eventHandler);
            }
            catch (Exception e)
            {
                Assert.Fail("Catch exception: " + e.Message.ToString());
            }

            tlog.Debug(tag, $"AddEventHandler END");
        }
        public void RemoveHandlerWithNullEventNameThrowsException()
        {
            var wem = new WeakEventManager();

            Assert.Throws <ArgumentNullException>(() => wem.RemoveEventHandler((sender, args) => { }, null));
        }
        public void RemoveHandlerWithNullEventHandlerThrowsException()
        {
            var wem = new WeakEventManager();

            Assert.Throws <ArgumentNullException>(() => wem.RemoveEventHandler(null, "test"));
        }
示例#5
0
 public void RemoveHandler(INotifyPropertyChanged source, string eventName, EventHandler <PropertyChangedEventArgs> handler)
 {
     weakEventManager.RemoveEventHandler(handler, eventName);
 }
        public void RemoveHandlerWithNullEventNameThrowsException()
        {
            var wem = new WeakEventManager();

            wem.RemoveEventHandler((sender, args) => { }, null);
        }
        public void RemoveHandlerWithNullEventHandlerThrowsException()
        {
            var wem = new WeakEventManager();

            wem.RemoveEventHandler(null, "test");
        }