コード例 #1
0
        /// <summary>
        /// Create a new instance of this class
        /// </summary>
        /// <param name="view">The view to use</param>
        /// <param name="project">The project</param>
        /// <param name="isNewProject">Indicates if the project was newly created</param>
        /// <param name="projectManager">The project manager to use</param>
        /// <param name="runner">The rule runner to use</param>
        /// <param name="violationList">The violation list to sue</param>
        public MainController(IMainView view,
                              ICalidusProjectModel project,
                              bool isNewProject,
                              ICalidusProjectManager projectManager,
                              IRuleRunner runner,
                              IRuleViolationList violationList)
        {
            _view = view;

            _view.Open += new EventHandler <EventArgs>(_view_Open);
            _view.Save += new EventHandler <EventArgs>(_view_Save);
            _view.Quit += new EventHandler <QuitEventArgs>(_view_Quit);

            _view.ProjectConfiguration += new EventHandler <EventArgs>(_view_ProjectConfiguration);
            _view.RuleConfiguration    += new EventHandler <EventArgs>(_view_RuleConfiguration);

            _projectManager = projectManager;

            _runner            = runner;
            _runner.Started   += new EventHandler <EventArgs>(_runner_Started);
            _runner.Completed += new EventHandler <RuleRunnerEventArgs>(_runner_Completed);

            _violationList = violationList;

            _project             = project;
            _project.Changed    += new EventHandler <EventArgs>(_project_Changed);
            _project.ProjectSet += new EventHandler <EventArgs>(_project_ProjectSet);

            //set project details
            _view.SelectedProject = _project.GetProjectFile();
            HasChanges            = isNewProject;
        }
コード例 #2
0
        /// <summary>
        /// Create a new instance of this class
        /// </summary>
        /// <param name="view">The view to use</param>
        /// <param name="project">The project to use</param>
        public FileTreeController(IFileTreeView view, ICalidusProjectModel project)
        {
            _view = view;

            _project = project;

            _view.DisplaySourceFiles(_project.GetAllSourceFiles());
        }
コード例 #3
0
        /// <summary>
        /// Create a new instance of this class
        /// </summary>
        /// <param name="view">The view to use</param>
        /// <param name="model">The model to use</param>
        public SourceLocationController(ISourceLocationView view, ICalidusProjectModel model)
        {
            _view = view;

            _model = model;

            _view.DisplayProjectFileLocation(_model.GetProjectFile());
        }
コード例 #4
0
        public RuleConfigurationWindow(ICalidusProjectModel project, ICalidusProjectManager manager)
        {
            InitializeComponent();
            _provider             = new CalidusRuleProvider();
            _configurationFactory = new CalidusRuleConfigurationFactory(project, manager);

            RuleConfigurationController controller = new RuleConfigurationController(ruleConfigurationView, _provider, _configurationFactory);
        }
コード例 #5
0
        public override void SetUp()
        {
            base.SetUp();

            _view          = Mocker.DynamicMock <IViolationListView>();
            _projectModel  = Mocker.DynamicMock <ICalidusProjectModel>();
            _violationList = Mocker.DynamicMock <IRuleViolationList>();
        }
コード例 #6
0
        public override void SetUp()
        {
            base.SetUp();

            _view          = Mocker.DynamicMock <IRuleRunnerView>();
            _runner        = Mocker.DynamicMock <IRuleRunner>();
            _projectModel  = Mocker.DynamicMock <ICalidusProjectModel>();
            _configFactory = Mocker.DynamicMock <ICalidusRuleConfigurationFactory>();
        }
コード例 #7
0
        public override void SetUp()
        {
            base.SetUp();

            _view = Mocker.DynamicMock <IMainView>();

            _projectModel = Mocker.DynamicMultiMock <ICalidusProjectModel>();

            _projectManager = Mocker.DynamicMultiMock <ICalidusProjectManager>();
            _ruleRunner     = Mocker.DynamicMock <IRuleRunner>();
            _violationList  = Mocker.DynamicMultiMock <IRuleViolationList>();
        }
コード例 #8
0
        /// <summary>
        /// Create a new instance of this class
        /// </summary>
        /// <param name="view">The view to use</param>
        /// <param name="project">The project</param>
        /// <param name="violationList">The violation list to display</param>
        public ViolationListController(IViolationListView view, ICalidusProjectModel project, IRuleViolationList violationList)
        {
            _view          = view;
            _project       = project;
            _violationList = violationList;

            _view.RuleViolationDetails += new EventHandler <RuleViolationEventArgs>(_view_RuleViolationDetails);
            _view.IgnoreViolation      += new EventHandler <RuleViolationIgnoreCommandEventArgs>(_view_IgnoreViolation);

            _violationList.ViolationAdded   += new EventHandler <RuleViolationEventArgs>(_violationList_ViolationAdded);
            _violationList.ViolationRemoved += new EventHandler <RuleViolationEventArgs>(_violationList_ViolationRemoved);
        }
コード例 #9
0
        /// <summary>
        /// Create a new instance of this class
        /// </summary>
        /// <param name="view">The view to use</param>
        /// <param name="runner">The runner to use</param>
        /// <param name="project">The projectmodel to use</param>
        public RuleRunnerController(IRuleRunnerView view, IRuleRunner runner, ICalidusProjectModel project, ICalidusRuleConfigurationFactory configFactory)
        {
            _view = view;
            _view.RuleRunnerStart += new EventHandler <EventArgs>(_view_RuleRunnerStart);

            _runner = runner;
            _runner.FileCompleted += new EventHandler <FileCompletedEventArgs>(_runner_FileCompleted);

            _project = project;

            _configFactory = configFactory;
        }
コード例 #10
0
        /// <summary>
        /// Create a new instance of this class
        /// </summary>
        /// <param name="view">The view to use</param>
        /// <param name="model">The model to use</param>
        public ProjectConfigurationController(IProjectConfigurationView view, ICalidusProjectModel model)
        {
            _model = model;
            _view  = view;

            _view.IgnoreAssemblyFiles = _model.IgnoreAssemblyFiles;
            _view.IgnoreDesignerFiles = _model.IgnoreDesignerFiles;
            _view.IgnoreProgramFiles  = _model.IgnoreProgramFiles;

            _view.IgnoreAssemblyFilesChanged += new EventHandler <CheckedEventArgs>(_view_IgnoreAssemblyFilesChanged);
            _view.IgnoreDesignerFilesChanged += new EventHandler <CheckedEventArgs>(_view_IgnoreDesignerFilesChanged);
            _view.IgnoreProgramFilesChanged  += new EventHandler <CheckedEventArgs>(_view_IgnoreProgramFilesChanged);
        }
コード例 #11
0
        public void SourceLocationControllerShouldDisplayProjectFileLocation()
        {
            ISourceLocationView  view  = Mocker.DynamicMock <ISourceLocationView>();
            ICalidusProjectModel model = Mocker.DynamicMock <ICalidusProjectModel>();

            Expect.Call(model.GetProjectFile()).Return("test.calidus").Repeat.Once();
            Expect.Call(() => view.DisplayProjectFileLocation("test.calidus")).Repeat.Once();

            Mocker.ReplayAll();

            SourceLocationController controller = new SourceLocationController(view, model);

            Mocker.VerifyAll();
        }
コード例 #12
0
        public override void SetUp()
        {
            base.SetUp();

            _view  = Mocker.DynamicMock <IProjectConfigurationView>();
            _model = Mocker.DynamicMock <ICalidusProjectModel>();

            Expect.Call(_model.IgnoreAssemblyFiles).Return(true).Repeat.Once();
            Expect.Call(_model.IgnoreDesignerFiles).Return(true).Repeat.Once();
            Expect.Call(_model.IgnoreProgramFiles).Return(true).Repeat.Once();

            Expect.Call(_view.IgnoreAssemblyFiles = true).Repeat.Once();
            Expect.Call(_view.IgnoreDesignerFiles = true).Repeat.Once();
            Expect.Call(_view.IgnoreProgramFiles  = true).Repeat.Once();
        }
コード例 #13
0
        public void MainControllerShouldSetViewSelectedProjectToProjectFileName()
        {
            IMainView              view           = Mocker.DynamicMock <IMainView>();
            ICalidusProjectModel   projectModel   = Mocker.DynamicMultiMock <ICalidusProjectModel>(typeof(ICalidusProject));
            ICalidusProjectManager projectManager = Mocker.DynamicMock <ICalidusProjectManager>();
            IRuleRunner            ruleRunner     = Mocker.DynamicMock <IRuleRunner>();
            IRuleViolationList     violationList  = Mocker.DynamicMock <IRuleViolationList>();

            //Expect.Call(view.SelectedProject = @"c:\test.calidus").Repeat.Once();
            Expect.Call(projectModel.GetProjectFile()).Return(@"c:\test.calidus").Repeat.Once();

            Mocker.ReplayAll();

            MainController controller = new MainController(view, projectModel, false, projectManager, ruleRunner, violationList);

            Mocker.VerifyAll();
        }
コード例 #14
0
        public void FileTreeControllerShouldCallViewDisplaySourceFiles()
        {
            IList <String> files = new List <String>();

            files.Add(@"C:\one.cs");
            files.Add(@"C:\two.cs");

            IFileTreeView        view  = Mocker.DynamicMock <IFileTreeView>();
            ICalidusProjectModel model = Mocker.DynamicMock <ICalidusProjectModel>();

            Expect.Call(model.GetAllSourceFiles()).Return(files).Repeat.Once();
            Expect.Call(() => view.DisplaySourceFiles(files)).Repeat.Once();

            Mocker.ReplayAll();

            FileTreeController controller = new FileTreeController(view, model);

            Mocker.VerifyAll();
        }
コード例 #15
0
        /// <summary>
        /// Displays the project configuration for the model
        /// </summary>
        /// <param name="model">The model to display for</param>
        public void ShowProjectConfiguration(ICalidusProjectModel model)
        {
            ProjectConfigurationWindow win = new ProjectConfigurationWindow(model);

            win.ShowDialog(this);
        }
コード例 #16
0
        /// <summary>
        /// Displays the rule configuration
        /// </summary>
        /// <param name="model">The model to display for</param>
        public void ShowRuleConfiguration(ICalidusProjectModel model)
        {
            RuleConfigurationWindow win = new RuleConfigurationWindow(model, new CalidusProjectManager());

            win.ShowDialog(this);
        }
コード例 #17
0
        public ProjectConfigurationWindow(ICalidusProjectModel model)
        {
            InitializeComponent();

            ProjectConfigurationController controller = new ProjectConfigurationController(projectConfigurationView, model);
        }