public void TwoCommandsTest()
 {
     var command1 = new ManualRelayCommand(o => { }, false);
     var subscriber1 = new CommandSubscriber(command1);
     var command2 = new ManualRelayCommand(o => { }, false);
     var subscriber2 = new CommandSubscriber(command2);
     command1.RaiseCanExecuteChanged();
     command2.RaiseCanExecuteChanged();
     Assert.AreEqual(1, subscriber1.Count);
     Assert.AreEqual(1, subscriber2.Count);
 }
 public void CheckWeakTest()
 {
     var command = new ManualRelayCommand(o => { }, false);
     var subscriber = new CommandSubscriber(command);
     WeakReference wr = new WeakReference(subscriber);
     Assert.IsTrue(wr.IsAlive);
     command.RaiseCanExecuteChanged();
     Assert.AreEqual(1, subscriber.Count);
     subscriber = null;
     GC.Collect();
     Assert.IsFalse(wr.IsAlive);
 }
Пример #3
0
 internal static void RemoveHandler(ManualRelayCommand source, EventHandler handler)
 {
     Manager.ProtectedRemoveHandler(source, handler);
 }