Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj
===================================================================
diff -u -r723f31df6ebe679dd2e20de9ee3095f242379631 -rf656ad7d168ebf3ac3a3e906ec8c8a88f9806ad9
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision 723f31df6ebe679dd2e20de9ee3095f242379631)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision f656ad7d168ebf3ac3a3e906ec8c8a88f9806ad9)
@@ -89,11 +89,11 @@
UserControl
-
+
UserControl
-
- NormView.cs
+
+ AssessmentSectionAssemblyCategoriesView.cs
@@ -255,6 +255,10 @@
DesignWaterLevelCalculationsView.cs
Designer
+
+ AssessmentSectionAssemblyCategoriesView.cs
+ Designer
+
WaveHeightCalculationsView.cs
Designer
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionAssemblyCategoriesView.Designer.cs
===================================================================
diff -u
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionAssemblyCategoriesView.Designer.cs (revision 0)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionAssemblyCategoriesView.Designer.cs (revision f656ad7d168ebf3ac3a3e906ec8c8a88f9806ad9)
@@ -0,0 +1,67 @@
+// 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.Views
+{
+ partial class AssessmentSectionAssemblyCategoriesView
+ {
+
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ #region Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AssessmentSectionAssemblyCategoriesView));
+ this.assessmentSectionAssemblyCategoriesTable = new Ringtoets.Integration.Forms.Views.AssessmentSectionAssemblyCategoriesTable();
+ this.SuspendLayout();
+ //
+ // failureMechanismSectionsTable
+ //
+ resources.ApplyResources(this.assessmentSectionAssemblyCategoriesTable, "assessmentSectionAssemblyCategoriesTable");
+ this.assessmentSectionAssemblyCategoriesTable.MultiSelect = true;
+ this.assessmentSectionAssemblyCategoriesTable.Name = "assessmentSectionAssemblyCategoriesTable";
+ this.assessmentSectionAssemblyCategoriesTable.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.RowHeaderSelect;
+ //
+ // FailureMechanismSectionsView
+ //
+ this.Controls.Add(this.assessmentSectionAssemblyCategoriesTable);
+ this.Name = "AssessmentSectionAssemblyCategoriesView";
+ resources.ApplyResources(this, "$this");
+ this.ResumeLayout(false);
+
+ }
+
+
+ #endregion
+
+ private AssessmentSectionAssemblyCategoriesTable assessmentSectionAssemblyCategoriesTable;
+ }
+}
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionAssemblyCategoriesView.cs
===================================================================
diff -u
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionAssemblyCategoriesView.cs (revision 0)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionAssemblyCategoriesView.cs (revision f656ad7d168ebf3ac3a3e906ec8c8a88f9806ad9)
@@ -0,0 +1,94 @@
+// 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;
+using System.Windows.Forms;
+using Core.Common.Base;
+using Core.Common.Controls.Views;
+using Ringtoets.AssemblyTool.Data;
+using Ringtoets.Common.Data.AssemblyTool;
+using Ringtoets.Common.Data.AssessmentSection;
+
+namespace Ringtoets.Integration.Forms.Views
+{
+ ///
+ /// View for a collection of .
+ ///
+ public partial class AssessmentSectionAssemblyCategoriesView : UserControl, IView
+ {
+ private readonly Observer failureMechanismContributionObserver;
+
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The assessment section the view belongs to.
+ /// Thrown when
+ /// is null.
+ public AssessmentSectionAssemblyCategoriesView(IAssessmentSection assessmentSection)
+ {
+ if (assessmentSection == null)
+ {
+ throw new ArgumentNullException(nameof(assessmentSection));
+ }
+
+ InitializeComponent();
+
+ failureMechanismContributionObserver = new Observer(UpdateTableData)
+ {
+ Observable = assessmentSection.FailureMechanismContribution
+ };
+
+ AssessmentSection = assessmentSection;
+
+ UpdateTableData();
+ }
+
+ ///
+ /// Gets the the view belongs to.
+ ///
+ public IAssessmentSection AssessmentSection { get; }
+
+ public object Data { get; set; }
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ failureMechanismContributionObserver.Dispose();
+
+ if (disposing)
+ {
+ components?.Dispose();
+ }
+
+ base.Dispose(disposing);
+ }
+
+ private void UpdateTableData()
+ {
+ assessmentSectionAssemblyCategoriesTable.SetData(AssemblyToolCategoriesFactory.CreateAssessmentSectionAssemblyCategories(
+ AssessmentSection.FailureMechanismContribution.SignalingNorm,
+ AssessmentSection.FailureMechanismContribution.LowerLimitNorm));
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionAssemblyCategoriesView.resx
===================================================================
diff -u
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionAssemblyCategoriesView.resx (revision 0)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionAssemblyCategoriesView.resx (revision f656ad7d168ebf3ac3a3e906ec8c8a88f9806ad9)
@@ -0,0 +1,159 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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
+
+
+
+ Fill
+
+
+
+ 0, 0
+
+
+ 750, 420
+
+
+
+ 0
+
+
+ assessmentSectionAssemblyCategoriesTable
+
+
+ Ringtoets.Common.Forms.Views.FailureMechanismSectionsTable, Ringtoets.Common.Forms, Version=18.1.1.1, Culture=neutral, PublicKeyToken=null
+
+
+ $this
+
+
+ 0
+
+
+ True
+
+
+ 750, 420
+
+
+ FailureMechanismSectionsView
+
+
+ System.Windows.Forms.UserControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj
===================================================================
diff -u -r723f31df6ebe679dd2e20de9ee3095f242379631 -rf656ad7d168ebf3ac3a3e906ec8c8a88f9806ad9
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 723f31df6ebe679dd2e20de9ee3095f242379631)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision f656ad7d168ebf3ac3a3e906ec8c8a88f9806ad9)
@@ -68,6 +68,7 @@
+
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssessmentSectionAssemblyCategoriesViewTest.cs
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssessmentSectionAssemblyCategoriesViewTest.cs (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssessmentSectionAssemblyCategoriesViewTest.cs (revision f656ad7d168ebf3ac3a3e906ec8c8a88f9806ad9)
@@ -0,0 +1,119 @@
+// 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;
+using System.Linq;
+using System.Windows.Forms;
+using Core.Common.Base;
+using Core.Common.Controls.Views;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.AssemblyTool.Data;
+using Ringtoets.AssemblyTool.KernelWrapper.Calculators;
+using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators;
+using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators.Categories;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.Forms.TestUtil;
+using Ringtoets.Integration.Forms.Views;
+
+namespace Ringtoets.Integration.Forms.Test.Views
+{
+ [TestFixture]
+ public class AssessmentSectionAssemblyCategoriesViewTest
+ {
+ [Test]
+ public void Constructor_AssessmentSectionNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate test = () => new AssessmentSectionAssemblyCategoriesView(null);
+
+ // Assert
+ string paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("assessmentSection", paramName);
+ }
+
+ [Test]
+ public void Constructor_WithData_CreatesViewAndTableWithData()
+ {
+ // Setup
+ var assessmentSection = new ObservableTestAssessmentSectionStub();
+
+ // Call
+ using (new AssemblyToolCalculatorFactoryConfig())
+ using (var view = new AssessmentSectionAssemblyCategoriesView(assessmentSection))
+ {
+ // Assert
+ Assert.IsInstanceOf(view);
+ Assert.IsInstanceOf(view);
+ Assert.IsNull(view.Data);
+ Assert.AreEqual(1, view.Controls.Count);
+ Assert.AreSame(assessmentSection, view.AssessmentSection);
+
+ AssessmentSectionAssemblyCategoriesTable tableControl = GetCategoriesTable(view);
+ Assert.NotNull(tableControl);
+ Assert.AreEqual(DockStyle.Fill, tableControl.Dock);
+ Assert.AreEqual(3, tableControl.Rows.Count);
+ }
+ }
+
+ [Test]
+ public void GivenViewWithAssessmentSection_WhenAssessmentSectionUpdated_ThenDataTableUpdated()
+ {
+ // Given
+ var mocks = new MockRepository();
+ var observer = mocks.StrictMock();
+ observer.Expect(o => o.UpdateObserver());
+ mocks.ReplayAll();
+
+ var assessmentSection = new ObservableTestAssessmentSectionStub();
+
+ using (new AssemblyToolCalculatorFactoryConfig())
+ using (var view = new AssessmentSectionAssemblyCategoriesView(assessmentSection))
+ {
+ AssessmentSectionAssemblyCategoriesTable categoriesTable = GetCategoriesTable(view);
+ assessmentSection.FailureMechanismContribution.Attach(observer);
+
+ // Precondition
+ Assert.AreEqual(3, categoriesTable.Rows.Count);
+
+ // When
+ var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
+ AssemblyCategoriesCalculatorStub calculator = calculatorFactory.LastCreatedAssemblyCategoriesCalculator;
+
+ calculator.AssessmentSectionCategoriesOutput = new[]
+ {
+ new AssessmentSectionAssemblyCategory(1, 2, AssessmentSectionAssemblyCategoryGroup.A)
+ };
+ assessmentSection.FailureMechanismContribution.NotifyObservers();
+
+ // Then
+ Assert.AreEqual(1, categoriesTable.Rows.Count);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ private static AssessmentSectionAssemblyCategoriesTable GetCategoriesTable(AssessmentSectionAssemblyCategoriesView view)
+ {
+ return ControlTestHelper.GetControls(view, "assessmentSectionAssemblyCategoriesTable").Single();
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssessmentSectionAssemblyCategoryRowTest.cs
===================================================================
diff -u -reda6f4a88f954fb580d72368c675254159425e43 -rf656ad7d168ebf3ac3a3e906ec8c8a88f9806ad9
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssessmentSectionAssemblyCategoryRowTest.cs (.../AssessmentSectionAssemblyCategoryRowTest.cs) (revision eda6f4a88f954fb580d72368c675254159425e43)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssessmentSectionAssemblyCategoryRowTest.cs (.../AssessmentSectionAssemblyCategoryRowTest.cs) (revision f656ad7d168ebf3ac3a3e906ec8c8a88f9806ad9)
@@ -41,7 +41,7 @@
// Assert
string paramName = Assert.Throws(test).ParamName;
- Assert.AreEqual("section", paramName);
+ Assert.AreEqual("assessmentSectionAssemblyCategory", paramName);
}
[Test]