/// <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)); }
/// <summary> /// Creates a new instance of this class /// </summary> public RuleConfigurationView() { InitializeComponent(); Load += new EventHandler(RuleConfigurationView_Load); _ruleTreeView = ruleTreeView; _currentRuleParameterControl = new Dictionary <String, EditParameterControl>(); _currentParameters = new Dictionary <String, IRuleConfigurationParameter>(); }
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(); }
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(); }