public void WeakEvent2()
        {
            var subscriber = new Subscriber();

            var(weakManager, _) = WeakEventHandlerCore(null, subscriber);
            GC.Collect();
            Assert.IsFalse(weakManager.TryGetTarget(out _));
        }
        public void WeakEventAddArgumentException()
        {
            var subscriber = new Subscriber();

            AssertHelper.ExpectedException <ArgumentNullException>(() => WeakEvent.StaticEventHandler <PropertyChangedEventArgs> .Add(null !, h => StaticPublisher.Event1 += h, h => StaticPublisher.Event1 -= h));
            AssertHelper.ExpectedException <ArgumentNullException>(() => WeakEvent.StaticEventHandler <PropertyChangedEventArgs> .Add(subscriber.Handler, null !, h => StaticPublisher.Event1 -= h));
            AssertHelper.ExpectedException <ArgumentNullException>(() => WeakEvent.StaticEventHandler <PropertyChangedEventArgs> .Add(subscriber.Handler, h => StaticPublisher.Event1         += h, null !));
        }
 public void Add(Subscriber subscriber) => Proxy = WeakEvent.StaticEventHandler <PropertyChangedEventArgs> .Add(subscriber.Handler, h => StaticPublisher.Event1 += h, h => StaticPublisher.Event1 -= h);