示例#1
0
        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;
        }
示例#2
0
        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();
        }