/// ------------------------------------------------------------------------------------ public ContributorsEditor(ComponentFile file, string imageKey, AutoCompleteValueGatherer autoCompleteProvider, PersonInformant personInformant) : base(file, null, imageKey) { InitializeComponent(); Name = "Contributors"; _model = new ContributorsListControlViewModel(autoCompleteProvider, SaveContributors); // ReSharper disable once UseObjectOrCollectionInitializer _contributorsControl = new ContributorsListControl(_model); _contributorsControl.Dock = DockStyle.Fill; _contributorsControl.ValidatingContributor += HandleValidatingContributor; InitializeGrid(); Controls.Add(_contributorsControl); file.AfterSave += file_AfterSave; SetComponentFile(file); if (personInformant != null) { personInformant.PersonUiIdChanged += HandlePersonsUiIdChanged; } }
public void GetAutoCompleteNames_HasGatherer_ReturnsNames() { var gatherer = new Mock <IAutoCompleteValueProvider>(); gatherer.Setup(g => g.GetValuesForKey("person")).Returns(new[] { "jimmy", "tommy" }); _model = new ContributorsListControlViewModel(gatherer.Object, null); var names = _model.GetAutoCompleteNames(); Assert.AreEqual(2, names.Count); Assert.IsTrue(names.Contains("jimmy")); Assert.IsTrue(names.Contains("tommy")); }
public void TestSetup() { var system = new OlacSystem(); _model = new ContributorsListControlViewModel(null, null); _contributions = new ContributionCollection(new[] { new Contribution("Leroy", system.GetRoles().ElementAt(0)), new Contribution("Jed", system.GetRoles().ElementAt(1)), new Contribution("Art", system.GetRoles().ElementAt(2)) }); _model.SetContributionList(_contributions); }
/// ------------------------------------------------------------------------------------ public ContributorsEditor(ComponentFile file, string imageKey, AutoCompleteValueGatherer autoCompleteProvider, PersonInformant personInformant) : base(file, null, imageKey) { InitializeComponent(); Name = "Contributors"; _model = new ContributorsListControlViewModel(autoCompleteProvider, SaveContributors); var dataGridView = new DataGridView(); dataGridView.Columns[dataGridView.Columns.Add("date", "date")].Visible = false; _model.ContributorsGridSettings = GridSettings.Create(dataGridView); // ReSharper disable once UseObjectOrCollectionInitializer _contributorsControl = new ContributorsListControl(_model); _contributorsControl.Dock = DockStyle.Fill; _contributorsControl.ValidatingContributor += HandleValidatingContributor; InitializeGrid(); // imageKey == "Contributor" when ContributorsEditor is lazy loaded for the session file type if (imageKey != null) { AddSessionControls(); } else { Controls.Add(_contributorsControl); } file.AfterSave += file_AfterSave; SetComponentFile(file); if (personInformant != null) { personInformant.PersonUiIdChanged += HandlePersonsUiIdChanged; } }
/// ------------------------------------------------------------------------------------ public ContributorsListControl(ContributorsListControlViewModel model) : this() { _model = model; _model.NewContributionListAvailable += HandleNewContributionListAvailable; Initialize(); }
/// ------------------------------------------------------------------------------------ public ContributorsListControl(ContributorsListControlViewModel model) : this() { _model = model; _model.NewContributionListAvailable += HandleNewContributionListAvailable; Initialize(); }