Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Dialogs/MergeDataProviderStub.Designer.cs =================================================================== diff -u -r0abc3d3c19968df4450672ef585b3262d00b3ff8 -rffc7f186d2cd1e12f3d0724fa241a524e8e0f561 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Dialogs/MergeDataProviderStub.Designer.cs (.../MergeDataProviderStub.Designer.cs) (revision 0abc3d3c19968df4450672ef585b3262d00b3ff8) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Dialogs/MergeDataProviderStub.Designer.cs (.../MergeDataProviderStub.Designer.cs) (revision ffc7f186d2cd1e12f3d0724fa241a524e8e0f561) @@ -54,11 +54,13 @@ this.flowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel(); this.okButton = new System.Windows.Forms.Button(); this.cancelButton = new System.Windows.Forms.Button(); + this.mergeInfoLabel = new System.Windows.Forms.Label(); this.flowLayoutPanel.SuspendLayout(); this.SuspendLayout(); // // flowLayoutPanel // + this.flowLayoutPanel.Controls.Add(this.mergeInfoLabel); this.flowLayoutPanel.Controls.Add(this.okButton); this.flowLayoutPanel.Controls.Add(this.cancelButton); this.flowLayoutPanel.Location = new System.Drawing.Point(3, 3); @@ -68,8 +70,8 @@ // // okButton // - this.okButton.DialogResult = DialogResult.OK; - this.okButton.Location = new System.Drawing.Point(3, 3); + this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK; + this.okButton.Location = new System.Drawing.Point(3, 29); this.okButton.Name = "okButton"; this.okButton.Size = new System.Drawing.Size(197, 23); this.okButton.TabIndex = 0; @@ -78,14 +80,24 @@ // // cancelButton // - this.cancelButton.DialogResult = DialogResult.Cancel; - this.cancelButton.Location = new System.Drawing.Point(3, 32); + this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.cancelButton.Location = new System.Drawing.Point(3, 58); this.cancelButton.Name = "cancelButton"; this.cancelButton.Size = new System.Drawing.Size(197, 23); this.cancelButton.TabIndex = 1; this.cancelButton.Text = "Annuleren"; this.cancelButton.UseVisualStyleBackColor = true; // + // mergeInfoLabel + // + this.mergeInfoLabel.AutoSize = true; + this.mergeInfoLabel.Location = new System.Drawing.Point(3, 0); + this.mergeInfoLabel.Name = "mergeInfoLabel"; + this.mergeInfoLabel.Size = new System.Drawing.Size(164, 26); + this.mergeInfoLabel.TabIndex = 2; + this.mergeInfoLabel.Text = "De hydraulische belastingen uit het nieuwe project zal worden overgenomen."; + this.mergeInfoLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // // MergeDataProviderStub // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -94,6 +106,7 @@ this.Name = "MergeDataProviderStub"; this.Size = new System.Drawing.Size(212, 111); this.flowLayoutPanel.ResumeLayout(false); + this.flowLayoutPanel.PerformLayout(); this.ResumeLayout(false); } @@ -103,5 +116,6 @@ private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel; private System.Windows.Forms.Button okButton; private System.Windows.Forms.Button cancelButton; + private Label mergeInfoLabel; } } \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Dialogs/MergeDataProviderStub.cs =================================================================== diff -u -r0abc3d3c19968df4450672ef585b3262d00b3ff8 -rffc7f186d2cd1e12f3d0724fa241a524e8e0f561 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Dialogs/MergeDataProviderStub.cs (.../MergeDataProviderStub.cs) (revision 0abc3d3c19968df4450672ef585b3262d00b3ff8) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Dialogs/MergeDataProviderStub.cs (.../MergeDataProviderStub.cs) (revision ffc7f186d2cd1e12f3d0724fa241a524e8e0f561) @@ -20,9 +20,9 @@ // All rights reserved. using System.Collections.Generic; +using System.Linq; using System.Windows.Forms; using Core.Common.Controls.Dialogs; -using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Integration.Data; using Ringtoets.Integration.Forms.Merge; @@ -40,7 +40,7 @@ /// /// public MergeDataProviderStub(IWin32Window dialogParent) - : base(dialogParent, RingtoetsCommonFormsResources.SelectionDialogIcon, 1, 1) + : base(dialogParent, RingtoetsCommonFormsResources.SelectionDialogIcon, 160, 160) { InitializeComponent(); } @@ -53,11 +53,13 @@ { if (ShowDialog() == DialogResult.OK) { - SelectedAssessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); - SelectedFailureMechanisms = new List - { - SelectedAssessmentSection.Piping - }; + SelectedAssessmentSection = assessmentSections?.First(); + SelectedFailureMechanisms = assessmentSections != null + ? new List + { + SelectedAssessmentSection.Piping + } + : null; return true; } Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Dialogs/MergeDataProviderStubTest.cs =================================================================== diff -u -r0abc3d3c19968df4450672ef585b3262d00b3ff8 -rffc7f186d2cd1e12f3d0724fa241a524e8e0f561 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Dialogs/MergeDataProviderStubTest.cs (.../MergeDataProviderStubTest.cs) (revision 0abc3d3c19968df4450672ef585b3262d00b3ff8) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Dialogs/MergeDataProviderStubTest.cs (.../MergeDataProviderStubTest.cs) (revision ffc7f186d2cd1e12f3d0724fa241a524e8e0f561) @@ -19,11 +19,14 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System.Linq; using System.Windows.Forms; using Core.Common.Controls.Dialogs; using NUnit.Extensions.Forms; using NUnit.Framework; using Rhino.Mocks; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Integration.Data; using Ringtoets.Integration.Forms.Dialogs; using Ringtoets.Integration.Forms.Merge; @@ -73,18 +76,18 @@ provider.SelectData(null); // Assert - var okButton = (Button)new ButtonTester("okButton", provider).TheObject; + var label = (Label) new LabelTester("mergeInfoLabel", provider).TheObject; + Assert.AreEqual("De hydraulische belastingen uit het nieuwe project zal worden overgenomen.", label.Text); + + var okButton = (Button) new ButtonTester("okButton", provider).TheObject; Assert.AreEqual("Ok", okButton.Text); Assert.IsTrue(okButton.Enabled); Assert.AreEqual("Annuleren", cancelButton.Text); Assert.AreEqual(cancelButton, provider.CancelButton); - Assert.AreEqual(1, provider.MinimumSize.Width); - Assert.AreEqual(1, provider.MinimumSize.Height); - - Assert.AreEqual(1, provider.MinimumSize.Width); - Assert.AreEqual(1, provider.MinimumSize.Height); + Assert.AreEqual(160, provider.MinimumSize.Width); + Assert.AreEqual(160, provider.MinimumSize.Height); } } @@ -105,7 +108,7 @@ using (var provider = new MergeDataProviderStub(dialogParent)) { // When - bool dataSelected= provider.SelectData(null); + bool dataSelected = provider.SelectData(null); // Then Assert.IsFalse(dataSelected); @@ -137,7 +140,7 @@ } [Test] - public void GivenDialog_WhenOkPressed_ThenSelectionPropertiesSet() + public void GivenDialog_WhenAssessmentSectionsGivenAndOkPressed_ThenSelectionPropertiesSet() { // Given DialogBoxHandler = (name, wnd) => @@ -149,6 +152,11 @@ } }; + var assessmentSections = new[] + { + new AssessmentSection(AssessmentSectionComposition.Dike) + }; + using (var dialogParent = new Form()) using (var provider = new MergeDataProviderStub(dialogParent)) { @@ -157,15 +165,44 @@ Assert.IsNull(provider.SelectedAssessmentSection); // When - provider.SelectData(null); + provider.SelectData(assessmentSections); // Then - Assert.IsNotNull(provider.SelectedAssessmentSection); + Assert.AreEqual(assessmentSections.First(), provider.SelectedAssessmentSection); CollectionAssert.AreEqual(new[] { provider.SelectedAssessmentSection.Piping }, provider.SelectedFailureMechanisms); } } + + [Test] + public void GivenDialog_WhenNullGivenAndOkPressed_ThenSelectionPropertiesSetToNull() + { + // Given + DialogBoxHandler = (name, wnd) => + { + using (new FormTester(name)) + { + var button = new ButtonTester("okButton", name); + button.Click(); + } + }; + + using (var dialogParent = new Form()) + using (var provider = new MergeDataProviderStub(dialogParent)) + { + // Precondition + Assert.IsNull(provider.SelectedAssessmentSection); + Assert.IsNull(provider.SelectedAssessmentSection); + + // When + provider.SelectData(null); + + // Then + Assert.IsNull(provider.SelectedAssessmentSection); + Assert.IsNull(provider.SelectedAssessmentSection); + } + } } } \ No newline at end of file