private void RuleTreeView_RuleSelectionChanged(object sender, RuleEventArgs e) { if (e.SelectedRule != null) { IRuleConfiguration config = _configFactory.GetRuleConfigurationFor(e.SelectedRule.GetType()); _view.DisplayRuleConfiguration(config); CurrentConfiguration = config; } else { _view.ClearRuleConfiguration(); CurrentConfiguration = null; } HasChanges = false; }
public void RuleConfigurationControllerShouldGetAndDisplayRuleConfigurationOnRuleSelectionChanged() { IRule rule = Mocker.DynamicMock <IRule>(); IRuleConfiguration ruleConfig = Mocker.DynamicMock <IRuleConfiguration>(); Expect.Call(_configFactory.GetRuleConfigurationFor(rule.GetType())).Return(ruleConfig).Repeat.Once(); Expect.Call(() => _view.DisplayRuleConfiguration(ruleConfig)).Repeat.Once(); Mocker.ReplayAll(); RuleConfigurationController controller = new RuleConfigurationController(_view, _provider, _configFactory); _view.RuleTreeView.Raise(x => x.RuleSelectionChanged += null, this, new RuleEventArgs(rule)); Mocker.VerifyAll(); }