private void RuleTreeView_BeforeRuleSelectionChanged(object sender, RuleChangeCancelEventArgs e) { if (!HasChanges || _view.ConfirmRuleSelectionChanged()) { e.Cancel = false; } else { e.Cancel = true; } }
public void RuleConfigurationControllerShouldNotCancelBeforeSelectionChangedIfConfirmed() { RuleChangeCancelEventArgs cancelArgs = new RuleChangeCancelEventArgs(); Expect.Call(_view.ConfirmRuleSelectionChanged()).Return(true); Mocker.ReplayAll(); RuleConfigurationController controller = new RuleConfigurationController(_view, _provider, _configFactory); //set changes _view.Raise(x => x.RuleParameterSettingsChanged += null, this, EventArgs.Empty); _view.RuleTreeView.Raise(x => x.BeforeRuleSelectionChanged += null, this, cancelArgs); Assert.IsFalse(cancelArgs.Cancel); Mocker.VerifyAll(); }