public void ConstructorWorks()
        {
            //arrange
            var view = new Mock<ITodoSettingsView>();
            var addTodoMarkerView = new Mock<IAddTodoMarkerView>();

            //act
            var controller = new TodoSettingPresenter(view.Object, addTodoMarkerView.Object);

            //assert
            Assert.IsNotNull(controller);
        }
예제 #2
0
        private void LoadWindow()
        {
            _treeview = new ConfigurationTreeViewControl(_config);

            splitContainer1.Panel1.Controls.Clear();
            splitContainer1.Panel1.Controls.Add(_treeview);
            _treeview.Dock = DockStyle.Fill;

            _generalSettingsView = new GeneralSettingsControl(_config.UserSettings.LanguageSetting, _configService);

            var markers      = _config.UserSettings.ToDoListSettings.ToDoMarkers;
            var gridViewSort = new GridViewSort <ToDoMarker>("Priority", true);

            _todoView       = new TodoListSettingsUserControl(markers, gridViewSort);
            _todoController = new TodoSettingPresenter(_todoView, new AddMarkerForm());

            ActivateControl(_generalSettingsView);
        }
예제 #3
0
        public SettingsDialog(IConfigurationService configService)
            : this()
        {
            _configService = configService;
            _config        = _configService.LoadConfiguration();
            _treeview      = new ConfigurationTreeViewControl(_config);

            this.splitContainer1.Panel1.Controls.Add(_treeview);
            _treeview.Dock = DockStyle.Fill;

            var markers = _config.UserSettings.ToDoListSettings.ToDoMarkers.ToList();

            _todoView = new TodoListSettingsUserControl(markers);

            ActivateControl(_todoView);
            _todoController = new TodoSettingPresenter(_todoView);

            RegisterEvents();
        }
        public void AddMarkerHidesOnCancel()
        {
            var markers = GetTestMarkers();

            var addView = new Mock<IAddTodoMarkerView>();
            addView.SetupProperty(a => a.MarkerPriority, TodoPriority.Low);
            addView.SetupProperty(a => a.MarkerText, "new marker");

            var view = new Mock<ITodoSettingsView>();

            // Shut up R#, I need that to process the event
            // ReSharper disable once UnusedVariable
            var presenter = new TodoSettingPresenter(view.Object, addView.Object);

            addView.Raise(v => v.Cancel += null, EventArgs.Empty);

            addView.Verify(a => a.Hide(), Times.Once());
        }
        public void AddMarkerReallyDoesAddNewMarker()
        {
            var markers = GetTestMarkers();

            var newMarkerText = "Hi, guys:";
            var newMarkerPriority = TodoPriority.High;

            var addView = new Mock<IAddTodoMarkerView>();
            addView.SetupProperty(a => a.MarkerText, newMarkerText);
            addView.SetupProperty(a => a.MarkerPriority, newMarkerPriority);
            addView.SetupProperty(a => a.TodoMarkers, markers);

            var view = new Mock<ITodoSettingsView>();
            view.SetupProperty(v => v.TodoMarkers, new BindingList<ToDoMarker>(markers));

            // Shut up R#, I need that to process the event
            // ReSharper disable once UnusedVariable
            var presenter = new TodoSettingPresenter(view.Object, addView.Object);

            addView.Raise(a => a.AddMarker += null, EventArgs.Empty);

            Assert.IsTrue(view.Object.TodoMarkers.Contains(new ToDoMarker(newMarkerText, newMarkerPriority)));
        }
        public void AddMarkerReallyDoesAllowExistingNames()
        {
            var markers = GetTestMarkers();

            var addView = new Mock<IAddTodoMarkerView>();
            addView.SetupProperty(a => a.MarkerText, "Hi, guys:");
            addView.SetupProperty(a => a.IsValidMarker);

            var view = new Mock<ITodoSettingsView>();
            view.SetupProperty(v => v.TodoMarkers, new BindingList<ToDoMarker>(markers));

            // Shut up R#, I need that to process the event
            // ReSharper disable once UnusedVariable
            var presenter = new TodoSettingPresenter(view.Object, addView.Object);

            addView.Raise(a => a.TextChanged += null, EventArgs.Empty);

            Assert.IsTrue(addView.Object.IsValidMarker);
        }
        public void AddReallyDoesDisplayAddMarkerWindow()
        {
            var markers = GetTestMarkers();

            var addView = new Mock<IAddTodoMarkerView>();

            var view = new Mock<ITodoSettingsView>();
            view.SetupProperty(v => v.TodoMarkers, new BindingList<ToDoMarker>(markers));

            // Shut up R#, I need that to process the event
            // ReSharper disable once UnusedVariable
            var presenter = new TodoSettingPresenter(view.Object, addView.Object);

            view.Raise(v => v.AddMarker += null, EventArgs.Empty);

            addView.Verify(a => a.Show(), Times.Once());
        }
        public void RemoveReallyDoesRemoveSelectedItem()
        {
            var markers = GetTestMarkers();

            var view = new Mock<ITodoSettingsView>();
            view.SetupProperty(v => v.TodoMarkers, new BindingList<ToDoMarker>(markers));

            // Shut up R#, I need that to process the event
            // ReSharper disable once UnusedVariable
            var presenter = new TodoSettingPresenter(view.Object, new Mock<IAddTodoMarkerView>().Object);

            view.Raise(v => v.RemoveMarker += null, EventArgs.Empty);

            Assert.AreEqual(markers.Count - 1, view.Object.TodoMarkers.Count);
        }
예제 #9
0
        private void LoadWindow()
        {
            _treeview = new ConfigurationTreeViewControl(_config);

            splitContainer1.Panel1.Controls.Clear();
            splitContainer1.Panel1.Controls.Add(_treeview);
            _treeview.Dock = DockStyle.Fill;

            _generalSettingsView = new GeneralSettingsControl(_config.UserSettings.LanguageSetting, _configService);

            var markers = _config.UserSettings.ToDoListSettings.ToDoMarkers;
            var gridViewSort = new GridViewSort<ToDoMarker>("Priority", true);
            _todoView = new TodoListSettingsUserControl(markers, gridViewSort);
            _todoController = new TodoSettingPresenter(_todoView, new AddMarkerForm());

            ActivateControl(_generalSettingsView);
        }