Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj
===================================================================
diff -u -r89bac9a8e55ebcf97e73e380c74d95e512e6980a -r59f04395e55958e417c2d7b6d3b5c31b48b55ae2
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision 89bac9a8e55ebcf97e73e380c74d95e512e6980a)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision 59f04395e55958e417c2d7b6d3b5c31b48b55ae2)
@@ -108,6 +108,12 @@
AssessmentSectionView.cs
+
+ UserControl
+
+
+ GeotechnicalFailureMechanismAssemblyCategoriesView.cs
+
UserControl
@@ -320,6 +326,9 @@
AssessmentSectionView.cs
+
+ GeotechnicalFailureMechanismAssemblyCategoriesView.cs
+
FailureMechanismAssemblyCategoriesView.cs
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/GeotechnicalFailureMechanismAssemblyCategoriesView.Designer.cs
===================================================================
diff -u
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/GeotechnicalFailureMechanismAssemblyCategoriesView.Designer.cs (revision 0)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/GeotechnicalFailureMechanismAssemblyCategoriesView.Designer.cs (revision 59f04395e55958e417c2d7b6d3b5c31b48b55ae2)
@@ -0,0 +1,89 @@
+// 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 Ringtoets.AssemblyTool.Data;
+
+namespace Ringtoets.Integration.Forms.Views
+{
+ partial class GeotechnicalFailureMechanismAssemblyCategoriesView
+ {
+
+ ///
+ /// 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()
+ {
+ this.failureMechanismSectionAssemblyCategoriesTable = new Ringtoets.Integration.Forms.Views.AssemblyCategoriesTable();
+ this.failureMechanismSectionAssemblyGroupBox = new System.Windows.Forms.GroupBox();
+ this.groupBoxPanel = new System.Windows.Forms.Panel();
+ this.groupBoxPanel.SuspendLayout();
+ this.failureMechanismSectionAssemblyGroupBox.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // failureMechanismSectionAssemblyCategoriesTable
+ //
+ this.failureMechanismSectionAssemblyCategoriesTable.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.failureMechanismSectionAssemblyCategoriesTable.MultiSelect = true;
+ this.failureMechanismSectionAssemblyCategoriesTable.Name = "failureMechanismSectionAssemblyCategoriesTable";
+ this.failureMechanismSectionAssemblyCategoriesTable.Padding = new System.Windows.Forms.Padding(5);
+ this.failureMechanismSectionAssemblyCategoriesTable.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.RowHeaderSelect;
+ //
+ // groupBoxPanel
+ //
+ this.groupBoxPanel.Controls.Add(this.failureMechanismSectionAssemblyGroupBox);
+ this.groupBoxPanel.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.groupBoxPanel.Name = "groupBoxPanel";
+ this.groupBoxPanel.Padding = new System.Windows.Forms.Padding(3);
+ //
+ // failureMechanismSectionAssemblyGroupBox
+ //
+ this.failureMechanismSectionAssemblyGroupBox.Controls.Add(this.failureMechanismSectionAssemblyCategoriesTable);
+ this.failureMechanismSectionAssemblyGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.failureMechanismSectionAssemblyGroupBox.Name = "failureMechanismSectionAssemblyGroupBox";
+ this.failureMechanismSectionAssemblyGroupBox.Text = global::Ringtoets.Integration.Forms.Properties.Resources.FailureMechanismSectionAssemblyCategories_DisplayName;
+ //
+ // FailureMechanismAssemblyCategoriesView
+ //
+ this.Controls.Add(this.groupBoxPanel);
+ this.Name = "GeotechnicalFailureMechanismAssemblyCategoriesView";
+ this.Size = new System.Drawing.Size(750, 420);
+ this.AutoScrollMinSize = new System.Drawing.Size(400, 100);
+ this.groupBoxPanel.ResumeLayout(false);
+ this.failureMechanismSectionAssemblyGroupBox.ResumeLayout(false);
+ this.ResumeLayout(false);
+ }
+
+
+ #endregion
+
+ private Ringtoets.Integration.Forms.Views.AssemblyCategoriesTable failureMechanismSectionAssemblyCategoriesTable;
+ private System.Windows.Forms.GroupBox failureMechanismSectionAssemblyGroupBox;
+ private System.Windows.Forms.Panel groupBoxPanel;
+ }
+}
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/GeotechnicalFailureMechanismAssemblyCategoriesView.cs
===================================================================
diff -u
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/GeotechnicalFailureMechanismAssemblyCategoriesView.cs (revision 0)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/GeotechnicalFailureMechanismAssemblyCategoriesView.cs (revision 59f04395e55958e417c2d7b6d3b5c31b48b55ae2)
@@ -0,0 +1,108 @@
+// 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.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using Core.Common.Base;
+using Ringtoets.AssemblyTool.Data;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Common.Forms.Helpers;
+using Ringtoets.Common.Forms.Views;
+
+namespace Ringtoets.Integration.Forms.Views
+{
+ ///
+ /// View for a geotechnical to show
+ /// its assembly categories.
+ ///
+ public partial class GeotechnicalFailureMechanismAssemblyCategoriesView : CloseForFailureMechanismView
+ {
+ private readonly Func> getFailureMechanismSectionAssemblyCategoriesFunc;
+ private readonly Observer failureMechanismObserver;
+ private readonly Observer assessmentSectionObserver;
+
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The failure mechanism belonging to the view.
+ /// The assessment section belonging to the view.
+ /// The function to get a collection
+ /// of .
+ /// Thrown when any parameter is null.
+ public GeotechnicalFailureMechanismAssemblyCategoriesView(IFailureMechanism failureMechanism,
+ IAssessmentSection assessmentSection,
+ Func> getFailureMechanismSectionAssemblyCategoriesFunc)
+ : base(failureMechanism)
+ {
+ if (assessmentSection == null)
+ {
+ throw new ArgumentNullException(nameof(assessmentSection));
+ }
+
+ if (getFailureMechanismSectionAssemblyCategoriesFunc == null)
+ {
+ throw new ArgumentNullException(nameof(getFailureMechanismSectionAssemblyCategoriesFunc));
+ }
+
+ this.getFailureMechanismSectionAssemblyCategoriesFunc = getFailureMechanismSectionAssemblyCategoriesFunc;
+
+ InitializeComponent();
+
+ failureMechanismObserver = new Observer(UpdateTableData)
+ {
+ Observable = failureMechanism
+ };
+
+ assessmentSectionObserver = new Observer(UpdateTableData)
+ {
+ Observable = assessmentSection
+ };
+
+ UpdateTableData();
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ failureMechanismObserver.Dispose();
+ assessmentSectionObserver.Dispose();
+
+ if (disposing)
+ {
+ components?.Dispose();
+ }
+
+ base.Dispose(disposing);
+ }
+
+ private void UpdateTableData()
+ {
+ failureMechanismSectionAssemblyCategoriesTable.SetData(
+ getFailureMechanismSectionAssemblyCategoriesFunc().Select(
+ category => new Tuple(
+ category,
+ AssemblyCategoryGroupColorHelper.GetFailureMechanismSectionAssemblyCategoryGroupColor(category.Group),
+ category.Group)).ToArray());
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/GeotechnicalFailureMechanismAssemblyCategoriesView.resx
===================================================================
diff -u
--- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/GeotechnicalFailureMechanismAssemblyCategoriesView.resx (revision 0)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/GeotechnicalFailureMechanismAssemblyCategoriesView.resx (revision 59f04395e55958e417c2d7b6d3b5c31b48b55ae2)
@@ -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/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj
===================================================================
diff -u -r89bac9a8e55ebcf97e73e380c74d95e512e6980a -r59f04395e55958e417c2d7b6d3b5c31b48b55ae2
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 89bac9a8e55ebcf97e73e380c74d95e512e6980a)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 59f04395e55958e417c2d7b6d3b5c31b48b55ae2)
@@ -82,6 +82,7 @@
+
Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/GeotechnicalFailureMechanismAssemblyCategoriesViewTest.cs
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/GeotechnicalFailureMechanismAssemblyCategoriesViewTest.cs (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/GeotechnicalFailureMechanismAssemblyCategoriesViewTest.cs (revision 59f04395e55958e417c2d7b6d3b5c31b48b55ae2)
@@ -0,0 +1,202 @@
+// 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.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.AssemblyTool.Data;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.Forms.TestUtil;
+using Ringtoets.Common.Forms.Views;
+using Ringtoets.Integration.Forms.Views;
+
+namespace Ringtoets.Integration.Forms.Test.Views
+{
+ [TestFixture]
+ public class GeotechnicalFailureMechanismAssemblyCategoriesViewTest
+ {
+ [Test]
+ public void Constructor_AssessmentSectionNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var failureMechanism = mocks.Stub();
+ mocks.ReplayAll();
+
+ // Call
+ TestDelegate test = () => new GeotechnicalFailureMechanismAssemblyCategoriesView(failureMechanism,
+ null,
+ Enumerable.Empty);
+
+ // Assert
+ string paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("assessmentSection", paramName);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Constructor_GetFailureMechanismSectionAssemblyCategoriesFuncNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var failureMechanism = mocks.Stub();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ // Call
+ TestDelegate test = () => new GeotechnicalFailureMechanismAssemblyCategoriesView(failureMechanism,
+ assessmentSection,
+ null);
+
+ // Assert
+ string paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("getFailureMechanismSectionAssemblyCategoriesFunc", paramName);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Constructor_WithValidParameters_CreatesViewAndTableWithData()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var failureMechanism = mocks.Stub();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ // Call
+ using (var view = new GeotechnicalFailureMechanismAssemblyCategoriesView(failureMechanism,
+ assessmentSection,
+ Enumerable.Empty))
+ {
+ // Assert
+ Assert.IsInstanceOf(view);
+ Assert.IsNull(view.Data);
+ Assert.AreEqual(1, view.Controls.Count);
+
+ Panel groupBoxPanel = ControlTestHelper.GetControls(view, "groupBoxPanel").Single();
+ Assert.AreEqual(1, groupBoxPanel.Controls.Count);
+ Assert.AreEqual(DockStyle.Fill, groupBoxPanel.Dock);
+
+ GroupBox failureMechanismSectionAssemblyGroupBox = ControlTestHelper.GetControls(groupBoxPanel, "failureMechanismSectionAssemblyGroupBox").Single();
+ Assert.AreEqual(1, failureMechanismSectionAssemblyGroupBox.Controls.Count);
+ Assert.AreEqual(DockStyle.Fill, failureMechanismSectionAssemblyGroupBox.Dock);
+ Assert.AreEqual("Categoriegrenzen per vak", failureMechanismSectionAssemblyGroupBox.Text);
+
+ AssemblyCategoriesTable failureMechanismSectionCategoriesTable = GetFailureMechanismSectionCategoriesTable(view);
+ Assert.AreEqual(DockStyle.Fill, failureMechanismSectionCategoriesTable.Dock);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void GivenViewWithValidData_WhenFailureMechanismUpdated_ThenDataTableUpdated()
+ {
+ // Given
+ var random = new Random(21);
+
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new TestFailureMechanism();
+
+ var nrOfCategories = 1;
+ Func> getFailureMechanismSectionCategories =
+ () => Enumerable.Repeat(CreateRandomFailureMechanismSectionAssemblyCategory(random), nrOfCategories);
+
+ using (var view = new GeotechnicalFailureMechanismAssemblyCategoriesView(failureMechanism,
+ assessmentSection,
+ getFailureMechanismSectionCategories))
+ {
+ AssemblyCategoriesTable failureMechanismSectionCategoriesTable = GetFailureMechanismSectionCategoriesTable(view);
+
+ // Precondition
+ Assert.AreEqual(nrOfCategories, failureMechanismSectionCategoriesTable.Rows.Count);
+
+ // When
+ nrOfCategories = 2;
+ failureMechanism.NotifyObservers();
+
+ // Then
+ Assert.AreEqual(nrOfCategories, failureMechanismSectionCategoriesTable.Rows.Count);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void GivenViewWithValidData_WhenAssessmentSectionUpdated_ThenDataTableUpdated()
+ {
+ // Given
+ var random = new Random(21);
+
+ var mocks = new MockRepository();
+ var failureMechanism = mocks.Stub();
+ mocks.ReplayAll();
+
+ var assessmentSection = new AssessmentSectionStub();
+
+ var nrOfCategories = 1;
+ Func> getFailureMechanismSectionCategories =
+ () => Enumerable.Repeat(CreateRandomFailureMechanismSectionAssemblyCategory(random), nrOfCategories);
+
+ using (var view = new GeotechnicalFailureMechanismAssemblyCategoriesView(failureMechanism,
+ assessmentSection,
+ getFailureMechanismSectionCategories))
+ {
+ AssemblyCategoriesTable failureMechanismSectionCategoriesTable = GetFailureMechanismSectionCategoriesTable(view);
+
+ // Precondition
+ Assert.AreEqual(nrOfCategories, failureMechanismSectionCategoriesTable.Rows.Count);
+
+ // When
+ nrOfCategories = 2;
+ assessmentSection.NotifyObservers();
+
+ // Then
+ Assert.AreEqual(nrOfCategories, failureMechanismSectionCategoriesTable.Rows.Count);
+ }
+
+ mocks.VerifyAll();
+ }
+
+ private static FailureMechanismSectionAssemblyCategory CreateRandomFailureMechanismSectionAssemblyCategory(Random random)
+ {
+ return new FailureMechanismSectionAssemblyCategory(random.NextDouble(),
+ random.NextDouble(),
+ random.NextEnumValue());
+ }
+
+ private static AssemblyCategoriesTable GetFailureMechanismSectionCategoriesTable(
+ GeotechnicalFailureMechanismAssemblyCategoriesView view)
+ {
+ return ControlTestHelper.GetControls>(
+ view, "failureMechanismSectionAssemblyCategoriesTable").Single();
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj
===================================================================
diff -u -rdee00ab2cf59f8d4ed966e25b429b7f131d5ccdf -r59f04395e55958e417c2d7b6d3b5c31b48b55ae2
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision dee00ab2cf59f8d4ed966e25b429b7f131d5ccdf)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision 59f04395e55958e417c2d7b6d3b5c31b48b55ae2)
@@ -145,6 +145,7 @@
+
Fisheye: Tag a5d89a068bbe74f954d1ef57266a39872afc9190 refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/GeotechnicalFailureMechanismAssemblyCategoriesViewInfoTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?