コード例 #1
0
        public void RuleTreeControllerShouldDisplayRulesAlphabeticallyFromRuleProvider()
        {
            IRule ruleAlpha = Mocker.DynamicMock <IRule>();
            IRule ruleBravo = Mocker.DynamicMock <IRule>();

            IList <IRule> rules = new List <IRule>();

            rules.Add(ruleBravo);
            rules.Add(ruleAlpha);

            IList <IRule> rulesSorted = new List <IRule>();

            rulesSorted.Add(rules[1]);
            rulesSorted.Add(rules[0]);

            TreeViewImp                      view          = new TreeViewImp(rulesSorted);
            ICalidusRuleProvider             ruleProvider  = Mocker.DynamicMock <ICalidusRuleProvider>();
            ICalidusRuleConfigurationFactory configFactory = Mocker.DynamicMock <ICalidusRuleConfigurationFactory>();

            Expect.Call(ruleAlpha.Category).Return("Alpha").Repeat.Any();
            Expect.Call(ruleBravo.Category).Return("Bravo").Repeat.Any();

            Expect.Call(ruleProvider.GetRules(configFactory)).Return(rules).Repeat.Once();
            Expect.Call(() => view.DisplayRules(rulesSorted)).Repeat.Once();

            Mocker.ReplayAll();

            RuleTreeController controller = new RuleTreeController(view, ruleProvider, configFactory);

            Mocker.VerifyAll();
        }
コード例 #2
0
        public RuleConfigurationWindow(ICalidusProjectModel project, ICalidusProjectManager manager)
        {
            InitializeComponent();
            _provider             = new CalidusRuleProvider();
            _configurationFactory = new CalidusRuleConfigurationFactory(project, manager);

            RuleConfigurationController controller = new RuleConfigurationController(ruleConfigurationView, _provider, _configurationFactory);
        }
コード例 #3
0
ファイル: RuleTreeController.cs プロジェクト: jdt/calidus
        /// <summary>
        /// Create a new instance of this class
        /// </summary>
        /// <param name="view">The view to use</param>
        /// <param name="ruleProvider">The rule provider to use</param>
        /// <param name="configFactory">The configuration factory</param>
        public RuleTreeController(IRuleTreeView view, ICalidusRuleProvider ruleProvider, ICalidusRuleConfigurationFactory configFactory)
        {
            _view          = view;
            _ruleProvider  = ruleProvider;
            _configFactory = configFactory;

            IEnumerable <IRule> rules = _ruleProvider.GetRules(_configFactory);

            _view.DisplayRules(rules.OrderBy(p => p.Category));
        }
コード例 #4
0
        public override void SetUp()
        {
            base.SetUp();

            _ruleTreeView  = Mocker.DynamicMock <IRuleTreeView>();
            _view          = Mocker.DynamicMock <IRuleConfigurationView>();
            _provider      = Mocker.DynamicMock <ICalidusRuleProvider>();
            _configFactory = Mocker.DynamicMock <ICalidusRuleConfigurationFactory>();

            Expect.Call(_view.RuleTreeView).Return(_ruleTreeView).Repeat.Any();
        }
コード例 #5
0
        public void RuleConfigurationControllerShouldDisplayRules()
        {
            IList <IRule> ruleList = new List <IRule>();

            IRuleTreeView          ruleTreeView = Mocker.DynamicMock <IRuleTreeView>();
            IRuleConfigurationView view         = Mocker.DynamicMock <IRuleConfigurationView>();
            ICalidusRuleProvider   provider     = Mocker.DynamicMock <ICalidusRuleProvider>();

            Expect.Call(view.RuleTreeView).Return(ruleTreeView).Repeat.Any();
            Expect.Call(provider.GetRules(_configFactory)).IgnoreArguments().Return(ruleList).Repeat.Once();
            Expect.Call(() => view.DisplayRules(ruleList)).Repeat.Once();

            Mocker.ReplayAll();

            RuleConfigurationController controller = new RuleConfigurationController(view, provider, _configFactory);

            Mocker.VerifyAll();
        }
コード例 #6
0
        /// <summary>
        /// Creates a new instance of this class
        /// </summary>
        /// <param name="view">The view to use</param>
        /// <param name="provider">The rule provider to use</param>
        /// <param name="configFactory">The configuration factory to use</param>
        public RuleConfigurationController(IRuleConfigurationView view, ICalidusRuleProvider provider, ICalidusRuleConfigurationFactory configFactory)
        {
            HasChanges = false;

            _configFactory = configFactory;

            _provider = provider;

            _view = view;
            _view.RuleTreeView.BeforeRuleSelectionChanged += new EventHandler <RuleChangeCancelEventArgs>(RuleTreeView_BeforeRuleSelectionChanged);
            _view.RuleTreeView.RuleSelectionChanged       += new EventHandler <RuleEventArgs>(RuleTreeView_RuleSelectionChanged);
            _view.SelectedRuleParameterChanged            += new EventHandler <RuleConfigurationParameterEventArgs>(_view_SelectedRuleParameterChanged);
            _view.RuleParameterSettingsChanged            += new EventHandler <EventArgs>(_view_RuleParameterSettingsChanged);
            _view.Save    += new EventHandler <RuleConfigurationChangeCommandEventArgs>(_view_Save);
            _view.Closing += new EventHandler <RuleChangeCancelEventArgs>(_view_Closing);

            IEnumerable <IRule> rules = _provider.GetRules(_configFactory);

            _view.DisplayRules(rules);
        }
コード例 #7
0
 /// <summary>
 /// Create a new instance of this class
 /// </summary>
 /// <param name="view">The view to use</param>
 /// <param name="ruleProvider">The rule provider to use</param>
 /// <param name="configFactory">The configuration factory to use</param>
 public CheckableRuleTreeController(ICheckableRuleTreeView view, ICalidusRuleProvider ruleProvider, ICalidusRuleConfigurationFactory configFactory)
     : base(view, ruleProvider, configFactory)
 {
 }