public void ViolationListControllerShouldRemoveViolationFromViewWhenViolationListViolationRemoved() { RuleViolation violation = new RuleViolation(String.Empty, null, new List <TokenBase>()); Expect.Call(() => _view.RemoveViolation(violation)).Repeat.Once(); Mocker.ReplayAll(); _controller = new ViolationListController(_view, _projectModel, _violationList); _violationList.Raise(x => x.ViolationRemoved += null, this, new RuleViolationEventArgs(violation)); Mocker.VerifyAll(); }
public void ViolationListControllerShouldIgnoreFileAndRemoveViolationsFromViolationListOnViewIgnoreViolationFile() { RuleViolation violation = new RuleViolation("file.cs", null, new List <TokenBase>()); Expect.Call(() => _projectModel.IgnoredFile("file.cs")).Repeat.Once(); Mocker.ReplayAll(); _controller = new ViolationListController(_view, _projectModel, _violationList); _view.Raise(x => x.IgnoreViolation += null, this, new RuleViolationIgnoreCommandEventArgs(violation, RuleViolationIgnoreType.File)); Mocker.VerifyAll(); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //get the project file StartUpWindow win = new StartUpWindow(); win.ShowDialog(); //if a file selected if (win.DialogResult == DialogResult.OK) { //build main objects CalidusProjectManager projectManager = new CalidusProjectManager(); CalidusProjectModel project = new CalidusProjectModel(projectManager.ReadFrom(win.SelectedProjectFile)); CalidusRuleConfigurationFactory configFactory = new CalidusRuleConfigurationFactory(project, projectManager); RuleRunner runner = new RuleRunner(); RuleViolationList violationList = new RuleViolationList(); //prepare main view MainWindow mainView = new MainWindow(); //assign controllers MainController c = new MainController(mainView, project, win.IsNewProject, projectManager, runner, violationList); ViolationListController violationListController = new ViolationListController(mainView.ViolationListView, project, violationList); CheckableRuleTreeController checkableRuleListController = new CheckableRuleTreeController(mainView.CheckableRuleTreeView, new CalidusRuleProvider(), configFactory); FileTreeController fileListController = new FileTreeController(mainView.FileListView, project); SourceLocationController sourceLocationController = new SourceLocationController(mainView.SourceLocationView, project); RuleRunnerController ruleRunnerController = new RuleRunnerController(mainView.RuleRunnerView, runner, project, configFactory); StatusController statusController = new StatusController(mainView.StatusView, violationList); //run application Application.Run(mainView); } }