public void UnregisterCommandDisconnectsCanExecuteChangedDelegate() { TestableCompositeCommand multiCommand = new TestableCompositeCommand(); TestCommand testCommandOne = new TestCommand() { CanExecuteValue = true }; multiCommand.RegisterCommand(testCommandOne); multiCommand.UnregisterCommand(testCommandOne); multiCommand.CanExecuteChangedRaised = false; testCommandOne.FireCanExecuteChanged(); Assert.IsFalse(multiCommand.CanExecuteChangedRaised); }
public void ShouldReraiseCanExecuteChangedEvent() { TestableCompositeCommand multiCommand = new TestableCompositeCommand(); TestCommand testCommandOne = new TestCommand() { CanExecuteValue = true }; Assert.IsFalse(multiCommand.CanExecuteChangedRaised); multiCommand.RegisterCommand(testCommandOne); multiCommand.CanExecuteChangedRaised = false; testCommandOne.FireCanExecuteChanged(); Assert.IsTrue(multiCommand.CanExecuteChangedRaised); }
public void ShouldReraiseCanExecuteChangedEventAfterCollect() { TestableCompositeCommand multiCommand = new TestableCompositeCommand(); TestCommand testCommandOne = new TestCommand() { CanExecuteValue = true }; Assert.IsFalse(multiCommand.CanExecuteChangedRaised); multiCommand.RegisterCommand(testCommandOne); multiCommand.CanExecuteChangedRaised = false; GC.Collect(); testCommandOne.FireCanExecuteChanged(); Assert.IsTrue(multiCommand.CanExecuteChangedRaised); }