Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Merge/AssessmentSectionMergeDataProviderDialog.Designer.cs =================================================================== diff -u -rc36b47c2e1e8cf948767cca33f80ad735f370ad0 -rce6893c628a4f5e22301b1d36269dd81a4fddb01 --- Riskeer/Integration/src/Riskeer.Integration.Forms/Merge/AssessmentSectionMergeDataProviderDialog.Designer.cs (.../AssessmentSectionMergeDataProviderDialog.Designer.cs) (revision c36b47c2e1e8cf948767cca33f80ad735f370ad0) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/Merge/AssessmentSectionMergeDataProviderDialog.Designer.cs (.../AssessmentSectionMergeDataProviderDialog.Designer.cs) (revision ce6893c628a4f5e22301b1d36269dd81a4fddb01) @@ -54,20 +54,18 @@ this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AssessmentSectionMergeDataProviderDialog)); this.toolTip = new System.Windows.Forms.ToolTip(this.components); - this.infoIcon = new System.Windows.Forms.PictureBox(); - this.tableLayoutPanelForForm = new System.Windows.Forms.TableLayoutPanel(); - this.assessmentSectionSelectLabel = new System.Windows.Forms.Label(); - this.assessmentSectionComboBox = new System.Windows.Forms.ComboBox(); - this.tableLayoutPanelForLabel = new System.Windows.Forms.TableLayoutPanel(); - this.failureMechanismSelectLabel = new System.Windows.Forms.Label(); - this.dataGridViewControl = new Core.Common.Controls.DataGrid.DataGridViewControl(); this.flowLayoutPanelButtons = new System.Windows.Forms.FlowLayoutPanel(); this.cancelButton = new System.Windows.Forms.Button(); this.importButton = new System.Windows.Forms.Button(); - ((System.ComponentModel.ISupportInitialize)(this.infoIcon)).BeginInit(); - this.tableLayoutPanelForForm.SuspendLayout(); - this.tableLayoutPanelForLabel.SuspendLayout(); + this.infoIcon = new System.Windows.Forms.PictureBox(); + this.dataGridViewControl = new Core.Common.Controls.DataGrid.DataGridViewControl(); + this.tableLayoutPanelForLabel = new System.Windows.Forms.TableLayoutPanel(); + this.failureMechanismSelectLabel = new System.Windows.Forms.Label(); + this.tableLayoutPanelForForm = new System.Windows.Forms.TableLayoutPanel(); this.flowLayoutPanelButtons.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize) (this.infoIcon)).BeginInit(); + this.tableLayoutPanelForLabel.SuspendLayout(); + this.tableLayoutPanelForForm.SuspendLayout(); this.SuspendLayout(); // // toolTip @@ -76,37 +74,44 @@ this.toolTip.InitialDelay = 100; this.toolTip.ReshowDelay = 100; // - // infoIcon + // flowLayoutPanelButtons // - resources.ApplyResources(this.infoIcon, "infoIcon"); - this.infoIcon.Name = "infoIcon"; - this.infoIcon.TabStop = false; + resources.ApplyResources(this.flowLayoutPanelButtons, "flowLayoutPanelButtons"); + this.flowLayoutPanelButtons.Controls.Add(this.cancelButton); + this.flowLayoutPanelButtons.Controls.Add(this.importButton); + this.flowLayoutPanelButtons.Controls.Add(this.infoIcon); + this.flowLayoutPanelButtons.Name = "flowLayoutPanelButtons"; // - // tableLayoutPanelForForm + // cancelButton // - resources.ApplyResources(this.tableLayoutPanelForForm, "tableLayoutPanelForForm"); - this.tableLayoutPanelForForm.Controls.Add(this.assessmentSectionSelectLabel, 0, 0); - this.tableLayoutPanelForForm.Controls.Add(this.assessmentSectionComboBox, 0, 1); - this.tableLayoutPanelForForm.Controls.Add(this.tableLayoutPanelForLabel, 0, 2); - this.tableLayoutPanelForForm.Controls.Add(this.dataGridViewControl, 0, 3); - this.tableLayoutPanelForForm.Controls.Add(this.flowLayoutPanelButtons, 0, 4); - this.tableLayoutPanelForForm.Name = "tableLayoutPanelForForm"; + this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; + resources.ApplyResources(this.cancelButton, "cancelButton"); + this.cancelButton.Name = "cancelButton"; + this.cancelButton.UseVisualStyleBackColor = true; // - // assessmentSectionSelectLabel + // importButton // - resources.ApplyResources(this.assessmentSectionSelectLabel, "assessmentSectionSelectLabel"); - this.assessmentSectionSelectLabel.Name = "assessmentSectionSelectLabel"; + this.importButton.DialogResult = System.Windows.Forms.DialogResult.OK; + resources.ApplyResources(this.importButton, "importButton"); + this.importButton.Name = "importButton"; + this.importButton.UseVisualStyleBackColor = true; // - // assessmentSectionComboBox + // infoIcon // - resources.ApplyResources(this.assessmentSectionComboBox, "assessmentSectionComboBox"); - this.assessmentSectionComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.assessmentSectionComboBox.Name = "assessmentSectionComboBox"; + resources.ApplyResources(this.infoIcon, "infoIcon"); + this.infoIcon.Name = "infoIcon"; + this.infoIcon.TabStop = false; // + // dataGridViewControl + // + resources.ApplyResources(this.dataGridViewControl, "dataGridViewControl"); + this.dataGridViewControl.MultiSelect = true; + this.dataGridViewControl.Name = "dataGridViewControl"; + this.dataGridViewControl.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.RowHeaderSelect; + // // tableLayoutPanelForLabel // resources.ApplyResources(this.tableLayoutPanelForLabel, "tableLayoutPanelForLabel"); - this.tableLayoutPanelForLabel.Controls.Add(this.infoIcon, 1, 0); this.tableLayoutPanelForLabel.Controls.Add(this.failureMechanismSelectLabel, 0, 0); this.tableLayoutPanelForLabel.Name = "tableLayoutPanelForLabel"; // @@ -115,49 +120,28 @@ resources.ApplyResources(this.failureMechanismSelectLabel, "failureMechanismSelectLabel"); this.failureMechanismSelectLabel.Name = "failureMechanismSelectLabel"; // - // dataGridViewControl + // tableLayoutPanelForForm // - resources.ApplyResources(this.dataGridViewControl, "dataGridViewControl"); - this.dataGridViewControl.MultiSelect = true; - this.dataGridViewControl.Name = "dataGridViewControl"; - this.dataGridViewControl.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.RowHeaderSelect; + resources.ApplyResources(this.tableLayoutPanelForForm, "tableLayoutPanelForForm"); + this.tableLayoutPanelForForm.Controls.Add(this.tableLayoutPanelForLabel, 0, 1); + this.tableLayoutPanelForForm.Controls.Add(this.dataGridViewControl, 0, 2); + this.tableLayoutPanelForForm.Controls.Add(this.flowLayoutPanelButtons, 0, 3); + this.tableLayoutPanelForForm.Name = "tableLayoutPanelForForm"; // - // flowLayoutPanelButtons - // - resources.ApplyResources(this.flowLayoutPanelButtons, "flowLayoutPanelButtons"); - this.flowLayoutPanelButtons.Controls.Add(this.cancelButton); - this.flowLayoutPanelButtons.Controls.Add(this.importButton); - this.flowLayoutPanelButtons.Name = "flowLayoutPanelButtons"; - // - // cancelButton - // - resources.ApplyResources(this.cancelButton, "cancelButton"); - this.cancelButton.DialogResult = DialogResult.Cancel; - this.cancelButton.Name = "cancelButton"; - this.cancelButton.UseVisualStyleBackColor = true; - // - // importButton - // - resources.ApplyResources(this.importButton, "importButton"); - this.importButton.DialogResult = DialogResult.OK; - this.importButton.Name = "importButton"; - this.importButton.UseVisualStyleBackColor = true; - // // AssessmentSectionMergeDataProviderDialog // resources.ApplyResources(this, "$this"); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.tableLayoutPanelForForm); this.Name = "AssessmentSectionMergeDataProviderDialog"; - ((System.ComponentModel.ISupportInitialize)(this.infoIcon)).EndInit(); - this.tableLayoutPanelForForm.ResumeLayout(false); - this.tableLayoutPanelForForm.PerformLayout(); + this.flowLayoutPanelButtons.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize) (this.infoIcon)).EndInit(); this.tableLayoutPanelForLabel.ResumeLayout(false); this.tableLayoutPanelForLabel.PerformLayout(); - this.flowLayoutPanelButtons.ResumeLayout(false); + this.tableLayoutPanelForForm.ResumeLayout(false); + this.tableLayoutPanelForForm.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); - } #endregion @@ -166,12 +150,10 @@ private System.Windows.Forms.TableLayoutPanel tableLayoutPanelForLabel; private System.Windows.Forms.ToolTip toolTip; private System.Windows.Forms.PictureBox infoIcon; - private System.Windows.Forms.Label assessmentSectionSelectLabel; private System.Windows.Forms.Label failureMechanismSelectLabel; private System.Windows.Forms.FlowLayoutPanel flowLayoutPanelButtons; private System.Windows.Forms.Button cancelButton; private System.Windows.Forms.Button importButton; private Core.Common.Controls.DataGrid.DataGridViewControl dataGridViewControl; - private System.Windows.Forms.ComboBox assessmentSectionComboBox; } } \ No newline at end of file Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Merge/AssessmentSectionMergeDataProviderDialog.cs =================================================================== diff -u -r97ebacf8fe8568ca69c3e45a2973e14c7554bac5 -rce6893c628a4f5e22301b1d36269dd81a4fddb01 --- Riskeer/Integration/src/Riskeer.Integration.Forms/Merge/AssessmentSectionMergeDataProviderDialog.cs (.../AssessmentSectionMergeDataProviderDialog.cs) (revision 97ebacf8fe8568ca69c3e45a2973e14c7554bac5) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/Merge/AssessmentSectionMergeDataProviderDialog.cs (.../AssessmentSectionMergeDataProviderDialog.cs) (revision ce6893c628a4f5e22301b1d36269dd81a4fddb01) @@ -62,7 +62,6 @@ : base(dialogParent, RiskeerCommonFormsResources.SelectionDialogIcon, 720, 590) { InitializeComponent(); - InitializeComboBox(); InitializeTooltip(); InitializeDataGridView(); } @@ -79,7 +78,7 @@ throw new ArgumentException($@"{nameof(assessmentSections)} must at least have one element.", nameof(assessmentSections)); } - SetComboBoxData(assessmentSections); + SetDataGridViewData(assessmentSections.Single()); if (ShowDialog() == DialogResult.OK) { @@ -106,7 +105,7 @@ }; constructionProperties.MergeSpecificFailurePaths.AddRange(GetSelectedSpecificFailurePathsToMerge()); - return new AssessmentSectionMergeData((AssessmentSection) assessmentSectionComboBox.SelectedItem, + return new AssessmentSectionMergeData(assessmentSections.Single(), constructionProperties); } @@ -118,11 +117,6 @@ return cancelButton; } - private void InitializeComboBox() - { - assessmentSectionComboBox.SelectedIndexChanged += AssessmentSectionComboBoxOnSelectedIndexChanged; - } - private void InitializeDataGridView() { dataGridViewControl.AddCheckBoxColumn(nameof(FailureMechanismMergeDataRow.IsSelected), @@ -160,29 +154,8 @@ .ToArray(); } - #region Event Handling - - private void AssessmentSectionComboBoxOnSelectedIndexChanged(object sender, EventArgs eventArgs) - { - if (assessmentSectionComboBox.SelectedIndex == -1) - { - return; - } - - SetDataGridViewData((AssessmentSection) assessmentSectionComboBox.SelectedItem); - } - - #endregion - #region Data Setters - private void SetComboBoxData(IEnumerable assessmentSections) - { - assessmentSectionComboBox.DataSource = null; - assessmentSectionComboBox.DataSource = assessmentSections.ToArray(); - assessmentSectionComboBox.DisplayMember = nameof(AssessmentSection.Name); - } - private void SetDataGridViewData(AssessmentSection assessmentSection) { failurePathMergeDataRows = new[] Index: Riskeer/Integration/src/Riskeer.Integration.Forms/Merge/AssessmentSectionMergeDataProviderDialog.resx =================================================================== diff -u -re0dcffbb95db5bca7fc428b51403e7b5f002774e -rce6893c628a4f5e22301b1d36269dd81a4fddb01 --- Riskeer/Integration/src/Riskeer.Integration.Forms/Merge/AssessmentSectionMergeDataProviderDialog.resx (.../AssessmentSectionMergeDataProviderDialog.resx) (revision e0dcffbb95db5bca7fc428b51403e7b5f002774e) +++ Riskeer/Integration/src/Riskeer.Integration.Forms/Merge/AssessmentSectionMergeDataProviderDialog.resx (.../AssessmentSectionMergeDataProviderDialog.resx) (revision ce6893c628a4f5e22301b1d36269dd81a4fddb01) @@ -1,441 +1,418 @@  - - - - - - - + + + + - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - - - Bottom, Right + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, + PublicKeyToken=b77a5c561934e089 + + + + 17, 17 + + + + True + + + + NoControl + + + + 400, 3 + + + 75, 23 + + + 0 + + + Annuleren - - Center + + cancelButton - - - 455, 8 + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 7, 7, 7, 0 + + flowLayoutPanelButtons - - 16, 16 - - - + 0 - - infoIcon + + NoControl + + + 319, 3 + + + 75, 23 + + + 1 + + + Importeren - - System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + importButton - - tableLayoutPanelForLabel + + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 0 + + flowLayoutPanelButtons - - True - - + 1 - - Bottom + + Center + + + Fill + + + NoControl + + + 293, 7 + + + 7, 7, 7, 7 + + + 16, 15 + + + 0 + + + infoIcon - - 3, 14 + + System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - 478, 16 + + flowLayoutPanelButtons - - 0 + + 2 - - Selecteer traject: + + Bottom + + + RightToLeft + + + 3, 280 + + + 478, 29 + + + 3 + + + flowLayoutPanelButtons - - BottomLeft + + System.Windows.Forms.FlowLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - assessmentSectionSelectLabel - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - + tableLayoutPanelForForm - - 0 + + 2 - - Fill + + Fill + + + 3, 33 + + + 478, 241 + + + 2 + + + dataGridViewControl - - 3, 33 + + Core.Common.Controls.DataGrid.DataGridViewControl, Core.Common.Controls, Version=21.2.1.1, Culture=neutral, PublicKeyToken=null - - 478, 21 - - - 0 - - - assessmentSectionComboBox - - - System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - + tableLayoutPanelForForm - + 1 - - 2 - - - True - - - Bottom - - - 3, 11 - - - 113, 13 - - - 0 - - + + 2 + + + True + + + Bottom + + + NoControl + + + 3, 11 + + + 113, 13 + + + 0 + + Selecteer toetssporen: - - MiddleLeft - - + + MiddleLeft + + failureMechanismSelectLabel - + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + tableLayoutPanelForLabel - - 1 + + 0 - - Fill - - - 3, 60 - - - 1 - - - 478, 24 - - - 1 - - + + Fill + + + 3, 3 + + + 1 + + + 478, 24 + + + 1 + + tableLayoutPanelForLabel - + System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + tableLayoutPanelForForm - - 2 - - - <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="infoIcon" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="failureMechanismSelectLabel" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="AutoSize,0,Percent,100" /><Rows Styles="Percent,100" /></TableLayoutSettings> - - - Fill - - - 3, 90 - - - 478, 184 - - - 2 - - - dataGridViewControl - - - Core.Common.Controls.DataGrid.DataGridViewControl, Core.Common.Controls, Version=18.1.1.1, Culture=neutral, PublicKeyToken=null - - - tableLayoutPanelForForm - - - 3 - - - True - - - 400, 3 - - - 75, 23 - - + 0 - - Annuleren - - - cancelButton - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - flowLayoutPanelButtons - - - 0 - - - 319, 3 - - - 75, 23 - - - 1 - - - Importeren - - - importButton - - - System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - flowLayoutPanelButtons - - - 1 - - - Bottom - - - RightToLeft - - - 3, 280 - - - 478, 29 - - - 3 - - - flowLayoutPanelButtons - - - System.Windows.Forms.FlowLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - + + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control + Name="failureMechanismSelectLabel" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns + Styles="AutoSize,0,Percent,100" /><Rows Styles="Percent,100" /></TableLayoutSettings> + + + + True + + + 1 + + + Fill + + + 0, 0 + + + 4 + + + 484, 312 + + + 0 + + tableLayoutPanelForForm - - 4 - - - Fill - - - 0, 0 - - - 5 - - - 484, 312 - - - 0 - - - tableLayoutPanelForForm - - + System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + $this - + 0 - - <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="assessmentSectionSelectLabel" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="assessmentSectionComboBox" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="tableLayoutPanelForLabel" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="dataGridViewControl" Row="3" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="flowLayoutPanelButtons" Row="4" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="Percent,100" /><Rows Styles="Absolute,30,AutoSize,0,Absolute,30,Percent,100,AutoSize,0" /></TableLayoutSettings> - - - True - - - 6, 13 - - - 484, 312 - - - 500, 350 - - + + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control + Name="tableLayoutPanelForLabel" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control + Name="dataGridViewControl" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /><Control + Name="flowLayoutPanelButtons" Row="3" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns + Styles="Percent,100" /><Rows Styles="AutoSize,0,Absolute,30,Percent,100,AutoSize,0" /></TableLayoutSettings> + + + + True + + + 6, 13 + + + 484, 312 + + + 500, 350 + + Selecteer trajectinformatie - + toolTip - + System.Windows.Forms.ToolTip, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + AssessmentSectionMergeDataProviderDialog - + System.Windows.Forms.Form, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 \ No newline at end of file Index: Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Merge/AssessmentSectionMergeDataProviderDialogTest.cs =================================================================== diff -u -r68b02d607d704885a5d113d2766b237c207a1de6 -rce6893c628a4f5e22301b1d36269dd81a4fddb01 --- Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Merge/AssessmentSectionMergeDataProviderDialogTest.cs (.../AssessmentSectionMergeDataProviderDialogTest.cs) (revision 68b02d607d704885a5d113d2766b237c207a1de6) +++ Riskeer/Integration/test/Riskeer.Integration.Forms.Test/Merge/AssessmentSectionMergeDataProviderDialogTest.cs (.../AssessmentSectionMergeDataProviderDialogTest.cs) (revision ce6893c628a4f5e22301b1d36269dd81a4fddb01) @@ -35,7 +35,6 @@ using Riskeer.Common.Data.FailureMechanism; using Riskeer.Common.Forms.Properties; using Riskeer.Integration.Data; -using Riskeer.Integration.Data.FailurePath; using Riskeer.Integration.Data.Merge; using Riskeer.Integration.Forms.Merge; using Riskeer.Integration.TestUtil; @@ -57,10 +56,10 @@ public void Constructor_DialogParentNull_ThrowsArgumentNullException() { // Call - TestDelegate call = () => new AssessmentSectionMergeDataProviderDialog(null); + void Call() => new AssessmentSectionMergeDataProviderDialog(null); // Assert - var exception = Assert.Throws(call); + var exception = Assert.Throws(Call); Assert.AreEqual("dialogParent", exception.ParamName); } @@ -105,24 +104,15 @@ var tableLayoutPanel = (TableLayoutPanel) new ControlTester("tableLayoutPanelForForm").TheObject; Assert.AreEqual(1, tableLayoutPanel.ColumnCount); - Assert.AreEqual(5, tableLayoutPanel.RowCount); + Assert.AreEqual(4, tableLayoutPanel.RowCount); - var assessmentSectionSelectLabel = (Label) tableLayoutPanel.GetControlFromPosition(0, 0); - Assert.AreEqual("Selecteer traject:", assessmentSectionSelectLabel.Text); - - var assessmentSectionComboBox = (ComboBox) tableLayoutPanel.GetControlFromPosition(0, 1); - Assert.IsTrue(assessmentSectionComboBox.Enabled); - Assert.AreEqual(ComboBoxStyle.DropDownList, assessmentSectionComboBox.DropDownStyle); - CollectionAssert.IsEmpty(assessmentSectionComboBox.Items); - - var tableLayoutPanelForLabels = (TableLayoutPanel) tableLayoutPanel.GetControlFromPosition(0, 2); + var tableLayoutPanelForLabels = (TableLayoutPanel) tableLayoutPanel.GetControlFromPosition(0, 1); Assert.AreEqual(2, tableLayoutPanelForLabels.ColumnCount); Assert.AreEqual(1, tableLayoutPanelForLabels.RowCount); var failureMechanismSelectionLabel = (Label) tableLayoutPanelForLabels.GetControlFromPosition(0, 0); Assert.AreEqual("Selecteer toetssporen:", failureMechanismSelectionLabel.Text); - Assert.IsInstanceOf(tableLayoutPanelForLabels.GetControlFromPosition(1, 0)); - Assert.IsInstanceOf(tableLayoutPanel.GetControlFromPosition(0, 3)); + Assert.IsInstanceOf(tableLayoutPanel.GetControlFromPosition(0, 2)); var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; Assert.AreEqual(columnCount, dataGridView.ColumnCount); Assert.AreEqual(0, dataGridView.RowCount); @@ -147,10 +137,11 @@ Assert.AreEqual(DataGridViewAutoSizeColumnsMode.AllCells, dataGridView.AutoSizeColumnsMode); Assert.AreEqual(DataGridViewContentAlignment.MiddleCenter, dataGridView.ColumnHeadersDefaultCellStyle.Alignment); - var flowLayoutPanel = (FlowLayoutPanel) tableLayoutPanel.GetControlFromPosition(0, 4); + var flowLayoutPanel = (FlowLayoutPanel) tableLayoutPanel.GetControlFromPosition(0, 3); Control.ControlCollection flowLayoutPanelControls = flowLayoutPanel.Controls; - Assert.AreEqual(2, flowLayoutPanelControls.Count); - CollectionAssert.AllItemsAreInstancesOfType(flowLayoutPanelControls, typeof(Button)); + Assert.AreEqual(3, flowLayoutPanelControls.Count); + Control pictureBox = flowLayoutPanel.Controls[2]; + Assert.IsInstanceOf(pictureBox); var buttonSelect = (Button) new ButtonTester("importButton", dialog).TheObject; Assert.AreEqual("Importeren", buttonSelect.Text); @@ -229,19 +220,17 @@ } [Test] - public void GetMergeData_WithAssessmentSections_SetsDataOnDialog() + public void GetMergeData_WithAssessmentSection_SetsDataOnDialog() { // Setup DialogBoxHandler = (formName, wnd) => { using (new FormTester(formName)) {} }; - var random = new Random(21); AssessmentSection[] assessmentSections = { - TestDataGenerator.GetAssessmentSectionWithAllCalculationConfigurationsAndFailurePaths(), - new AssessmentSection(random.NextEnumValue()) + TestDataGenerator.GetAssessmentSectionWithAllCalculationConfigurationsAndFailurePaths() }; using (var dialogParent = new Form()) @@ -253,10 +242,6 @@ // Assert AssessmentSection expectedDefaultSelectedAssessmentSection = assessmentSections[0]; - var comboBox = (ComboBox) new ComboBoxTester("assessmentSectionComboBox", dialog).TheObject; - Assert.AreSame(expectedDefaultSelectedAssessmentSection, comboBox.SelectedItem); - CollectionAssert.AreEqual(assessmentSections, comboBox.Items); - var dataGridView = (DataGridView) new ControlTester("dataGridView", dialog).TheObject; DataGridViewRowCollection rows = dataGridView.Rows; @@ -299,17 +284,12 @@ public void GivenValidDialog_WhenGetMergeDataCalledAndOnlyAssessmentSectionSelectedAndImportPressed_ThenReturnsSelectedData() { // Given - var random = new Random(21); AssessmentSection selectedAssessmentSection = TestDataGenerator.GetAssessmentSectionWithAllCalculationConfigurationsAndFailurePaths(); DialogBoxHandler = (formName, wnd) => { - using (var formTester = new FormTester(formName)) + using (new FormTester(formName)) { - var dialog = (AssessmentSectionMergeDataProviderDialog) formTester.TheObject; - var comboBox = (ComboBox) new ComboBoxTester("assessmentSectionComboBox", dialog).TheObject; - comboBox.SelectedItem = selectedAssessmentSection; - var button = new ButtonTester("importButton", formName); button.Click(); } @@ -321,7 +301,6 @@ // When AssessmentSectionMergeData result = dialog.GetMergeData(new[] { - new AssessmentSection(random.NextEnumValue()), selectedAssessmentSection }); @@ -354,16 +333,13 @@ public void GivenValidDialog_WhenGetMergeDataCalledAndAllDataSelectedAndImportPressed_ThenReturnsSelectedData() { // Given - var random = new Random(21); AssessmentSection selectedAssessmentSection = TestDataGenerator.GetAssessmentSectionWithAllCalculationConfigurationsAndFailurePaths(); DialogBoxHandler = (formName, wnd) => { using (var formTester = new FormTester(formName)) { var dialog = (AssessmentSectionMergeDataProviderDialog) formTester.TheObject; - var comboBox = (ComboBox) new ComboBoxTester("assessmentSectionComboBox", dialog).TheObject; - comboBox.SelectedItem = selectedAssessmentSection; var dataGridView = (DataGridView) new ControlTester("dataGridView", dialog).TheObject; @@ -385,7 +361,6 @@ // When AssessmentSectionMergeData result = dialog.GetMergeData(new[] { - new AssessmentSection(random.NextEnumValue()), selectedAssessmentSection }); @@ -414,51 +389,6 @@ } } - [Test] - public void GivenDialogWithAssessmentSection_WhenSelectingOtherAssessmentSection_ThenDataUpdated() - { - // Given - var random = new Random(21); - AssessmentSection[] assessmentSections = - { - TestDataGenerator.GetAssessmentSectionWithAllCalculationConfigurationsAndFailurePaths(), - new AssessmentSection(random.NextEnumValue()) - { - SpecificFailurePaths = - { - new SpecificFailurePath() - } - } - }; - - DialogBoxHandler = (formName, wnd) => - { - using (new FormTester(formName)) {} - }; - - using (var dialogParent = new Form()) - using (var dialog = new AssessmentSectionMergeDataProviderDialog(dialogParent)) - { - dialog.GetMergeData(assessmentSections); - - var comboBox = (ComboBox) new ComboBoxTester("assessmentSectionComboBox", dialog).TheObject; - var dataGridView = (DataGridView) new ControlTester("dataGridView", dialog).TheObject; - - // Precondition - AssessmentSection defaultSelectedAssessmentSection = assessmentSections[0]; - Assert.AreSame(defaultSelectedAssessmentSection, comboBox.SelectedItem); - AssertFailureMechanismRows(defaultSelectedAssessmentSection, dataGridView.Rows); - - // When - AssessmentSection itemToBeSelected = assessmentSections[1]; - comboBox.SelectedItem = itemToBeSelected; - - // Then - AssertFailureMechanismRows(itemToBeSelected, dataGridView.Rows); - AssertFailurePathRows(itemToBeSelected, dataGridView.Rows); - } - } - private static void AssertFailureMechanismRows(AssessmentSection expectedAssessmentSection, DataGridViewRowCollection rows) { AssertDataGridViewRow(expectedAssessmentSection.Piping, rows[0].Cells);