Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Dialogs/MergeDataProviderStub.Designer.cs
===================================================================
diff -u
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Dialogs/MergeDataProviderStub.Designer.cs (revision 0)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Dialogs/MergeDataProviderStub.Designer.cs (revision 0abc3d3c19968df4450672ef585b3262d00b3ff8)
@@ -0,0 +1,107 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System.Windows.Forms;
+
+namespace Ringtoets.Integration.Forms.Dialogs
+{
+ partial class MergeDataProviderStub
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.flowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel();
+ this.okButton = new System.Windows.Forms.Button();
+ this.cancelButton = new System.Windows.Forms.Button();
+ this.flowLayoutPanel.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // flowLayoutPanel
+ //
+ this.flowLayoutPanel.Controls.Add(this.okButton);
+ this.flowLayoutPanel.Controls.Add(this.cancelButton);
+ this.flowLayoutPanel.Location = new System.Drawing.Point(3, 3);
+ this.flowLayoutPanel.Name = "flowLayoutPanel";
+ this.flowLayoutPanel.Size = new System.Drawing.Size(200, 100);
+ this.flowLayoutPanel.TabIndex = 0;
+ //
+ // okButton
+ //
+ this.okButton.DialogResult = DialogResult.OK;
+ this.okButton.Location = new System.Drawing.Point(3, 3);
+ this.okButton.Name = "okButton";
+ this.okButton.Size = new System.Drawing.Size(197, 23);
+ this.okButton.TabIndex = 0;
+ this.okButton.Text = "Ok";
+ this.okButton.UseVisualStyleBackColor = true;
+ //
+ // cancelButton
+ //
+ this.cancelButton.DialogResult = DialogResult.Cancel;
+ this.cancelButton.Location = new System.Drawing.Point(3, 32);
+ 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;
+ //
+ // MergeDataProviderStub
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.flowLayoutPanel);
+ this.Name = "MergeDataProviderStub";
+ this.Size = new System.Drawing.Size(212, 111);
+ this.flowLayoutPanel.ResumeLayout(false);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel;
+ private System.Windows.Forms.Button okButton;
+ private System.Windows.Forms.Button cancelButton;
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Dialogs/MergeDataProviderStub.cs
===================================================================
diff -u
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Dialogs/MergeDataProviderStub.cs (revision 0)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Dialogs/MergeDataProviderStub.cs (revision 0abc3d3c19968df4450672ef585b3262d00b3ff8)
@@ -0,0 +1,72 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System.Collections.Generic;
+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;
+using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+
+namespace Ringtoets.Integration.Forms.Dialogs
+{
+ ///
+ /// Stub for providing merge data.
+ ///
+ public partial class MergeDataProviderStub : DialogBase, IMergeDataProvider
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ ///
+ public MergeDataProviderStub(IWin32Window dialogParent)
+ : base(dialogParent, RingtoetsCommonFormsResources.SelectionDialogIcon, 1, 1)
+ {
+ InitializeComponent();
+ }
+
+ public AssessmentSection SelectedAssessmentSection { get; private set; }
+
+ public IEnumerable SelectedFailureMechanisms { get; private set; }
+
+ public bool SelectData(IEnumerable assessmentSections)
+ {
+ if (ShowDialog() == DialogResult.OK)
+ {
+ SelectedAssessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike);
+ SelectedFailureMechanisms = new List
+ {
+ SelectedAssessmentSection.Piping
+ };
+ return true;
+ }
+
+ return false;
+ }
+
+ protected override Button GetCancelButton()
+ {
+ return cancelButton;
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Dialogs/MergeDataProviderStub.resx
===================================================================
diff -u
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Dialogs/MergeDataProviderStub.resx (revision 0)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Dialogs/MergeDataProviderStub.resx (revision 0abc3d3c19968df4450672ef585b3262d00b3ff8)
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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
+
+
\ No newline at end of file
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Merge/IMergeDataProvider.cs
===================================================================
diff -u -r26d78e501249bb0b55cb09889b0eba5adbef135f -r0abc3d3c19968df4450672ef585b3262d00b3ff8
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Merge/IMergeDataProvider.cs (.../IMergeDataProvider.cs) (revision 26d78e501249bb0b55cb09889b0eba5adbef135f)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Merge/IMergeDataProvider.cs (.../IMergeDataProvider.cs) (revision 0abc3d3c19968df4450672ef585b3262d00b3ff8)
@@ -44,6 +44,7 @@
/// Select the data to merge.
///
/// The collection of assessment sections to select from.
- void SelectData(IEnumerable assessmentSections);
+ /// Indicator whether selection succeeded.
+ bool SelectData(IEnumerable assessmentSections);
}
}
\ No newline at end of file
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj
===================================================================
diff -u -rd9d47cee30e2987819dfb5b8c0c935ee4a72e52a -r0abc3d3c19968df4450672ef585b3262d00b3ff8
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision d9d47cee30e2987819dfb5b8c0c935ee4a72e52a)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision 0abc3d3c19968df4450672ef585b3262d00b3ff8)
@@ -41,6 +41,12 @@
UserControl
+
+ Form
+
+
+ MergeDataProviderStub.cs
+
@@ -304,6 +310,9 @@
BackgroundMapDataSelectionDialog.cs
+
+ MergeDataProviderStub.cs
+
PublicResXFileCodeGenerator
Designer
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Dialogs/AssessmentSectionProviderStubTest.cs
===================================================================
diff -u -r6f5c52d004002ab044ef28be11efaa12b0b6940a -r0abc3d3c19968df4450672ef585b3262d00b3ff8
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Dialogs/AssessmentSectionProviderStubTest.cs (.../AssessmentSectionProviderStubTest.cs) (revision 6f5c52d004002ab044ef28be11efaa12b0b6940a)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Dialogs/AssessmentSectionProviderStubTest.cs (.../AssessmentSectionProviderStubTest.cs) (revision 0abc3d3c19968df4450672ef585b3262d00b3ff8)
@@ -105,7 +105,7 @@
[Test]
public void GivenDialog_WhenCancelPressed_ThenReturnNull()
{
- // Setup
+ // Given
DialogBoxHandler = (name, wnd) =>
{
using (new FormTester(name))
@@ -118,18 +118,18 @@
using (var dialogParent = new Form())
using (var provider = new AssessmentSectionProviderStub(dialogParent))
{
- // Call
+ // When
IEnumerable assessmentSections = provider.GetAssessmentSections(null);
- // Assert
+ // Then
Assert.IsNull(assessmentSections);
}
}
[Test]
public void GivenDialog_WhenInvalidProjectButtonPressed_ThenReturnNull()
{
- // Setup
+ // Given
DialogBoxHandler = (name, wnd) =>
{
using (new FormTester(name))
@@ -142,18 +142,18 @@
using (var dialogParent = new Form())
using (var provider = new AssessmentSectionProviderStub(dialogParent))
{
- // Call
+ // When
IEnumerable assessmentSections = provider.GetAssessmentSections(null);
- // Assert
+ // Then
Assert.IsNull(assessmentSections);
}
}
[Test]
public void GivenDialog_WhenNoMatchButtonPressed_ThenReturnEmptyCollection()
{
- // Setup
+ // Given
DialogBoxHandler = (name, wnd) =>
{
using (new FormTester(name))
@@ -166,18 +166,18 @@
using (var dialogParent = new Form())
using (var provider = new AssessmentSectionProviderStub(dialogParent))
{
- // Call
+ // When
IEnumerable assessmentSections = provider.GetAssessmentSections(null);
- // Assert
+ // Then
CollectionAssert.IsEmpty(assessmentSections);
}
}
[Test]
public void GivenDialog_WhenMatchButtonPressed_ThenReturnCollectionWithOneAssessmentSection()
{
- // Setup
+ // Given
DialogBoxHandler = (name, wnd) =>
{
using (new FormTester(name))
@@ -190,10 +190,10 @@
using (var dialogParent = new Form())
using (var provider = new AssessmentSectionProviderStub(dialogParent))
{
- // Call
+ // When
IEnumerable assessmentSections = provider.GetAssessmentSections(null);
- // Assert
+ // Then
Assert.AreEqual(1, assessmentSections.Count());
}
}
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Dialogs/MergeDataProviderStubTest.cs
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Dialogs/MergeDataProviderStubTest.cs (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Dialogs/MergeDataProviderStubTest.cs (revision 0abc3d3c19968df4450672ef585b3262d00b3ff8)
@@ -0,0 +1,171 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System.Windows.Forms;
+using Core.Common.Controls.Dialogs;
+using NUnit.Extensions.Forms;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Integration.Forms.Dialogs;
+using Ringtoets.Integration.Forms.Merge;
+
+namespace Ringtoets.Integration.Forms.Test.Dialogs
+{
+ [TestFixture]
+ public class MergeDataProviderStubTest : NUnitFormTest
+ {
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var dialogParent = mocks.StrictMock();
+ mocks.ReplayAll();
+
+ // Call
+ using (var provider = new MergeDataProviderStub(dialogParent))
+ {
+ // Assert
+ Assert.IsInstanceOf(provider);
+ Assert.IsInstanceOf(provider);
+ mocks.VerifyAll();
+ }
+ }
+
+ [Test]
+ public void SelectData_Always_ShowsDialog()
+ {
+ // Setup
+ Button cancelButton = null;
+
+ DialogBoxHandler = (name, wnd) =>
+ {
+ using (new FormTester(name))
+ {
+ var button = new ButtonTester("cancelButton", name);
+ cancelButton = (Button) button.TheObject;
+ button.Click();
+ }
+ };
+
+ using (var dialogParent = new Form())
+ using (var provider = new MergeDataProviderStub(dialogParent))
+ {
+ // Call
+ provider.SelectData(null);
+
+ // Assert
+ 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);
+ }
+ }
+
+ [Test]
+ public void GivenDialog_WhenCancelPressed_ThenReturnFalse()
+ {
+ // Given
+ DialogBoxHandler = (name, wnd) =>
+ {
+ using (new FormTester(name))
+ {
+ var button = new ButtonTester("cancelButton", name);
+ button.Click();
+ }
+ };
+
+ using (var dialogParent = new Form())
+ using (var provider = new MergeDataProviderStub(dialogParent))
+ {
+ // When
+ bool dataSelected= provider.SelectData(null);
+
+ // Then
+ Assert.IsFalse(dataSelected);
+ }
+ }
+
+ [Test]
+ public void GivenDialog_WhenOkPressed_ThenReturnTrue()
+ {
+ // 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))
+ {
+ // When
+ bool dataSelected = provider.SelectData(null);
+
+ // Then
+ Assert.IsTrue(dataSelected);
+ }
+ }
+
+ [Test]
+ public void GivenDialog_WhenOkPressed_ThenSelectionPropertiesSet()
+ {
+ // 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.IsNotNull(provider.SelectedAssessmentSection);
+ CollectionAssert.AreEqual(new[]
+ {
+ provider.SelectedAssessmentSection.Piping
+ }, provider.SelectedFailureMechanisms);
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj
===================================================================
diff -u -rc495cc79dec2d2b23b382df86cfcc78b977b14f3 -r0abc3d3c19968df4450672ef585b3262d00b3ff8
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision c495cc79dec2d2b23b382df86cfcc78b977b14f3)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 0abc3d3c19968df4450672ef585b3262d00b3ff8)
@@ -39,6 +39,7 @@
+