Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Ringtoets.StabilityPointStructures.Forms.csproj
===================================================================
diff -u -rbc4c4000ca4a850b49a88156ca2b919ea690494b -reab8aad1da52fe14404e06a6cc684dd6c391abe4
--- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Ringtoets.StabilityPointStructures.Forms.csproj (.../Ringtoets.StabilityPointStructures.Forms.csproj) (revision bc4c4000ca4a850b49a88156ca2b919ea690494b)
+++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Ringtoets.StabilityPointStructures.Forms.csproj (.../Ringtoets.StabilityPointStructures.Forms.csproj) (revision eab8aad1da52fe14404e06a6cc684dd6c391abe4)
@@ -56,6 +56,12 @@
+
+ UserControl
+
+
+ StabilityPointStructuresFailureMechanismView.cs
+
UserControl
@@ -94,6 +100,21 @@
Core.Common.Utils
False
+
+ {5a91174a-fb95-4c9d-9ca5-81c0b8d4361a}
+ Core.Components.DotSpatial.Forms
+ False
+
+
+ {4A06DF0D-5D75-4BAD-A95A-A3DB9B7C4AD5}
+ Core.Components.Gis.Forms
+ False
+
+
+ {318BA582-88C9-4816-A54A-A7E431461DE3}
+ Core.Components.Gis
+ False
+
{d4200f43-3f72-4f42-af0a-8ced416a38ec}
Ringtoets.Common.Data
@@ -109,6 +130,11 @@
Ringtoets.Common.Utils
False
+
+ {70F8CC9C-5BC8-4FB2-B201-EAE7FA8088C2}
+ Ringtoets.HydraRing.Data
+ False
+
{3d4b9740-8348-4434-8d77-b611fc6ee57f}
Ringtoets.StabilityPointStructures.Data
@@ -121,6 +147,9 @@
Resources.Designer.cs
Designer
+
+ StabilityPointStructuresFailureMechanismView.cs
+
StabilityPointStructuresScenariosView.cs
Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismView.Designer.cs
===================================================================
diff -u
--- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismView.Designer.cs (revision 0)
+++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismView.Designer.cs (revision eab8aad1da52fe14404e06a6cc684dd6c391abe4)
@@ -0,0 +1,65 @@
+// Copyright (C) Stichting Deltares 2016. 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.
+
+namespace Ringtoets.StabilityPointStructures.Forms.Views
+{
+ partial class StabilityPointStructuresFailureMechanismView
+ {
+ ///
+ /// 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.mapControl = new Core.Components.DotSpatial.Forms.MapControl();
+ this.SuspendLayout();
+ //
+ // MapView
+ //
+ this.mapControl.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.mapControl.Location = new System.Drawing.Point(0, 0);
+ this.mapControl.Name = "mapControl";
+ this.mapControl.Size = new System.Drawing.Size(150, 150);
+ this.mapControl.TabIndex = 0;
+ this.mapControl.Text = "mapControl1";
+ //
+ // StabilityPointStructuresFailureMechanismView
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.mapControl);
+ this.Name = "StabilityPointStructuresFailureMechanismView";
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private Core.Components.DotSpatial.Forms.MapControl mapControl;
+ }
+}
Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismView.cs
===================================================================
diff -u
--- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismView.cs (revision 0)
+++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismView.cs (revision eab8aad1da52fe14404e06a6cc684dd6c391abe4)
@@ -0,0 +1,184 @@
+// Copyright (C) Stichting Deltares 2016. 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.Base;
+using Core.Components.Gis.Data;
+using Core.Components.Gis.Features;
+using Core.Components.Gis.Forms;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.DikeProfiles;
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Common.Forms.Views;
+using Ringtoets.StabilityPointStructures.Data;
+using Ringtoets.StabilityPointStructures.Forms.PresentationObjects;
+using Ringtoets.HydraRing.Data;
+using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources;
+using StabilityPointStructuresDataResources = Ringtoets.StabilityPointStructures.Data.Properties.Resources;
+
+namespace Ringtoets.StabilityPointStructures.Forms.Views
+{
+ ///
+ /// This class is a view showing map data for a grass cover erosion outwards failure mechanism.
+ ///
+ public partial class StabilityPointStructuresFailureMechanismView : UserControl, IMapView
+ {
+ private readonly Observer failureMechanismObserver;
+ private readonly Observer assessmentSectionObserver;
+ private readonly Observer foreshoreProfilesObserver;
+ private readonly Observer structuresObserver;
+
+ private readonly MapLineData referenceLineMapData;
+ private readonly MapLineData sectionsMapData;
+ private readonly MapPointData sectionsStartPointMapData;
+ private readonly MapPointData sectionsEndPointMapData;
+ private readonly MapPointData hydraulicBoundaryDatabaseMapData;
+ private readonly MapLineData foreshoreProfilesMapData;
+ private readonly MapPointData structuresMapData;
+
+ private StabilityPointStructuresFailureMechanismContext data;
+
+ ///
+ /// Creates a new instance of .
+ ///
+ public StabilityPointStructuresFailureMechanismView()
+ {
+ InitializeComponent();
+
+ failureMechanismObserver = new Observer(UpdateMapData);
+ assessmentSectionObserver = new Observer(UpdateMapData);
+ foreshoreProfilesObserver = new Observer(UpdateMapData);
+ structuresObserver = new Observer(UpdateMapData);
+
+ referenceLineMapData = RingtoetsMapDataFactory.CreateReferenceLineMapData();
+ hydraulicBoundaryDatabaseMapData = RingtoetsMapDataFactory.CreateHydraulicBoundaryDatabaseMapData();
+ foreshoreProfilesMapData = RingtoetsMapDataFactory.CreateForeshoreProfileMapData();
+ structuresMapData = RingtoetsMapDataFactory.CreateStructuresMapData();
+
+ sectionsMapData = RingtoetsMapDataFactory.CreateFailureMechanismSectionsMapData();
+ sectionsStartPointMapData = RingtoetsMapDataFactory.CreateFailureMechanismSectionsStartPointMapData();
+ sectionsEndPointMapData = RingtoetsMapDataFactory.CreateFailureMechanismSectionsEndPointMapData();
+
+ mapControl.Data.Add(referenceLineMapData);
+ mapControl.Data.Add(sectionsMapData);
+ mapControl.Data.Add(sectionsStartPointMapData);
+ mapControl.Data.Add(sectionsEndPointMapData);
+ mapControl.Data.Add(hydraulicBoundaryDatabaseMapData);
+ mapControl.Data.Add(foreshoreProfilesMapData);
+ mapControl.Data.Add(structuresMapData);
+
+ mapControl.Data.Name = StabilityPointStructuresDataResources.StabilityPointStructuresFailureMechanism_DisplayName;
+ }
+
+ public object Data
+ {
+ get
+ {
+ return data;
+ }
+ set
+ {
+ data = value as StabilityPointStructuresFailureMechanismContext;
+
+ if (data == null)
+ {
+ failureMechanismObserver.Observable = null;
+ assessmentSectionObserver.Observable = null;
+ foreshoreProfilesObserver.Observable = null;
+ structuresObserver.Observable = null;
+
+ Map.ResetMapData();
+ return;
+ }
+
+ failureMechanismObserver.Observable = data.WrappedData;
+ assessmentSectionObserver.Observable = data.Parent;
+ foreshoreProfilesObserver.Observable = data.WrappedData.ForeshoreProfiles;
+ structuresObserver.Observable = data.WrappedData.StabilityPointStructures;
+
+ UpdateMapData();
+ }
+ }
+
+ public IMapControl Map
+ {
+ get
+ {
+ return mapControl;
+ }
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ failureMechanismObserver.Dispose();
+ assessmentSectionObserver.Dispose();
+ foreshoreProfilesObserver.Dispose();
+
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ private void UpdateMapData()
+ {
+ ReferenceLine referenceLine = null;
+ IEnumerable failureMechanismSections = null;
+ HydraulicBoundaryDatabase hydraulicBoundaryDatabase = null;
+ IEnumerable foreshoreProfiles = null;
+ IEnumerable structures = null;
+
+ if (data != null)
+ {
+ referenceLine = data.Parent.ReferenceLine;
+ failureMechanismSections = data.WrappedData.Sections;
+ hydraulicBoundaryDatabase = data.Parent.HydraulicBoundaryDatabase;
+ foreshoreProfiles = data.WrappedData.ForeshoreProfiles;
+ structures = data.WrappedData.StabilityPointStructures;
+ }
+
+ UpdateFeatureBasedMapData(referenceLineMapData,
+ RingtoetsMapDataFeaturesFactory.CreateReferenceLineFeatures(referenceLine));
+ UpdateFeatureBasedMapData(sectionsMapData,
+ RingtoetsMapDataFeaturesFactory.CreateFailureMechanismSectionFeatures(failureMechanismSections));
+ UpdateFeatureBasedMapData(sectionsStartPointMapData,
+ RingtoetsMapDataFeaturesFactory.CreateFailureMechanismSectionStartPointFeatures(failureMechanismSections));
+ UpdateFeatureBasedMapData(sectionsEndPointMapData,
+ RingtoetsMapDataFeaturesFactory.CreateFailureMechanismSectionEndPointFeatures(failureMechanismSections));
+ UpdateFeatureBasedMapData(hydraulicBoundaryDatabaseMapData,
+ RingtoetsMapDataFeaturesFactory.CreateHydraulicBoundaryDatabaseFeatures(hydraulicBoundaryDatabase));
+ UpdateFeatureBasedMapData(foreshoreProfilesMapData,
+ RingtoetsMapDataFeaturesFactory.CreateForeshoreProfilesFeatures(foreshoreProfiles));
+ UpdateFeatureBasedMapData(structuresMapData,
+ RingtoetsMapDataFeaturesFactory.CreateStructuresFeatures(structures));
+
+ mapControl.Data.NotifyObservers();
+ }
+
+ private static void UpdateFeatureBasedMapData(FeatureBasedMapData mapData, MapFeature[] features)
+ {
+ mapData.Features = features;
+ mapData.NotifyObservers();
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismView.resx
===================================================================
diff -u
--- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismView.resx (revision 0)
+++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismView.resx (revision eab8aad1da52fe14404e06a6cc684dd6c391abe4)
@@ -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/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Plugin/Ringtoets.StabilityPointStructures.Plugin.csproj
===================================================================
diff -u -rbc4c4000ca4a850b49a88156ca2b919ea690494b -reab8aad1da52fe14404e06a6cc684dd6c391abe4
--- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Plugin/Ringtoets.StabilityPointStructures.Plugin.csproj (.../Ringtoets.StabilityPointStructures.Plugin.csproj) (revision bc4c4000ca4a850b49a88156ca2b919ea690494b)
+++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Plugin/Ringtoets.StabilityPointStructures.Plugin.csproj (.../Ringtoets.StabilityPointStructures.Plugin.csproj) (revision eab8aad1da52fe14404e06a6cc684dd6c391abe4)
@@ -70,6 +70,11 @@
Core.Common.Gui
False
+
+ {4a06df0d-5d75-4bad-a95a-a3db9b7c4ad5}
+ Core.Components.Gis.Forms
+ False
+
{D4200F43-3F72-4F42-AF0A-8CED416A38EC}
Ringtoets.Common.Data
Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Plugin/StabilityPointStructuresPlugin.cs
===================================================================
diff -u -rf724e2a23cc180381b736c4da1318d87398e5758 -reab8aad1da52fe14404e06a6cc684dd6c391abe4
--- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Plugin/StabilityPointStructuresPlugin.cs (.../StabilityPointStructuresPlugin.cs) (revision f724e2a23cc180381b736c4da1318d87398e5758)
+++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Plugin/StabilityPointStructuresPlugin.cs (.../StabilityPointStructuresPlugin.cs) (revision eab8aad1da52fe14404e06a6cc684dd6c391abe4)
@@ -69,6 +69,14 @@
public override IEnumerable GetViewInfos()
{
+ yield return new ViewInfo
+ {
+ GetViewName = (view, mechanism) => mechanism.WrappedData.Name,
+ Image = RingtoetsCommonFormsResources.CalculationIcon,
+ CloseForData = CloseStabilityPointStructuresFailureMechanismViewForData,
+ AdditionalDataCheck = context => context.WrappedData.IsRelevant
+ };
+
yield return new ViewInfo<
FailureMechanismSectionResultContext,
IEnumerable,
@@ -188,6 +196,23 @@
#region ViewInfo
+ #region StabilityPointStructuresFailureMechanismView ViewInfo
+
+ private bool CloseStabilityPointStructuresFailureMechanismViewForData(StabilityPointStructuresFailureMechanismView view, object o)
+ {
+ var assessmentSection = o as IAssessmentSection;
+ var failureMechanism = o as StabilityPointStructuresFailureMechanism;
+
+ var viewFailureMechanismContext = (StabilityPointStructuresFailureMechanismContext)view.Data;
+ var viewFailureMechanism = viewFailureMechanismContext.WrappedData;
+
+ return assessmentSection != null
+ ? ReferenceEquals(viewFailureMechanismContext.Parent, assessmentSection)
+ : ReferenceEquals(viewFailureMechanism, failureMechanism);
+ }
+
+ #endregion
+
#region StabilityPointStructuresFailureMechanismResultView ViewInfo
private static bool CloseFailureMechanismResultViewForData(StabilityPointStructuresFailureMechanismResultView view, object viewData)
Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Ringtoets.StabilityPointStructures.Forms.Test.csproj
===================================================================
diff -u -r2d5e2d09b0cb1a7f48e1b0a067d332347c89d4a8 -reab8aad1da52fe14404e06a6cc684dd6c391abe4
--- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Ringtoets.StabilityPointStructures.Forms.Test.csproj (.../Ringtoets.StabilityPointStructures.Forms.Test.csproj) (revision 2d5e2d09b0cb1a7f48e1b0a067d332347c89d4a8)
+++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Ringtoets.StabilityPointStructures.Forms.Test.csproj (.../Ringtoets.StabilityPointStructures.Forms.Test.csproj) (revision eab8aad1da52fe14404e06a6cc684dd6c391abe4)
@@ -80,6 +80,7 @@
+
@@ -124,6 +125,18 @@
{D749EE4C-CE50-4C17-BF01-9A953028C126}
Core.Common.TestUtil
+
+ {5A91174A-FB95-4C9D-9CA5-81C0B8D4361A}
+ Core.Components.DotSpatial.Forms
+
+
+ {4A06DF0D-5D75-4BAD-A95A-A3DB9B7C4AD5}
+ Core.Components.Gis.Forms
+
+
+ {318BA582-88C9-4816-A54A-A7E431461DE3}
+ Core.Components.Gis
+
{D4200F43-3F72-4F42-AF0A-8CED416A38EC}
Ringtoets.Common.Data
Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Views/StabilityPointStructuresFailureMechanismViewTest.cs
===================================================================
diff -u
--- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Views/StabilityPointStructuresFailureMechanismViewTest.cs (revision 0)
+++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Views/StabilityPointStructuresFailureMechanismViewTest.cs (revision eab8aad1da52fe14404e06a6cc684dd6c391abe4)
@@ -0,0 +1,684 @@
+// Copyright (C) Stichting Deltares 2016. 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.Base;
+using Core.Common.Base.Geometry;
+using Core.Components.DotSpatial.Forms;
+using Core.Components.Gis.Data;
+using Core.Components.Gis.Forms;
+using NUnit.Framework;
+using Ringtoets.Common.Data;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.Contribution;
+using Ringtoets.Common.Data.DikeProfiles;
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.HydraRing.Data;
+using Ringtoets.StabilityPointStructures.Data;
+using Ringtoets.StabilityPointStructures.Data.TestUtil;
+using Ringtoets.StabilityPointStructures.Forms.PresentationObjects;
+using Ringtoets.StabilityPointStructures.Forms.Views;
+using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources;
+using StabilityPointStructuresDataResources = Ringtoets.StabilityPointStructures.Data.Properties.Resources;
+
+namespace Ringtoets.StabilityPointStructures.Forms.Test.Views
+{
+ [TestFixture]
+ public class StabilityPointStructuresFailureMechanismViewTest
+ {
+ private const int referenceLineIndex = 0;
+ private const int sectionsIndex = 1;
+ private const int sectionsStartPointIndex = 2;
+ private const int sectionsEndPointIndex = 3;
+ private const int hydraulicBoundaryDatabaseIndex = 4;
+ private const int foreshoreProfilesIndex = 5;
+ private const int structuresIndex = 6;
+
+ [Test]
+ public void DefaultConstructor_DefaultValues()
+ {
+ // Call
+ using (var view = new StabilityPointStructuresFailureMechanismView())
+ {
+ // Assert
+ Assert.IsInstanceOf(view);
+ Assert.IsInstanceOf(view);
+ Assert.IsNotNull(view.Map);
+ Assert.IsNull(view.Data);
+ }
+ }
+
+ [Test]
+ public void DefaultConstructor_Always_AddMapControlWithCollectionOfEmptyMapData()
+ {
+ // Call
+ using (var view = new StabilityPointStructuresFailureMechanismView())
+ {
+ // Assert
+ Assert.AreEqual(1, view.Controls.Count);
+ Assert.AreSame(view.Map, view.Controls[0]);
+ Assert.AreEqual(DockStyle.Fill, ((Control)view.Map).Dock);
+ Assert.AreEqual(StabilityPointStructuresDataResources.StabilityPointStructuresFailureMechanism_DisplayName, view.Map.Data.Name);
+ AssertEmptyMapData(view.Map.Data);
+ }
+ }
+
+ [Test]
+ public void Data_StabilityPointStructuresFailureMechanismContext_DataSet()
+ {
+ // Setup
+ using (var view = new StabilityPointStructuresFailureMechanismView())
+ {
+ var failureMechanismContext = new StabilityPointStructuresFailureMechanismContext(new StabilityPointStructuresFailureMechanism(), new TestAssessmentSection());
+
+ // Call
+ view.Data = failureMechanismContext;
+
+ // Assert
+ Assert.AreSame(failureMechanismContext, view.Data);
+ }
+ }
+
+ [Test]
+ public void Data_OtherThanStabilityPointStructuresFailureMechanismContext_DataNull()
+ {
+ // Setup
+ using (var view = new StabilityPointStructuresFailureMechanismView())
+ {
+ var data = new object();
+
+ // Call
+ view.Data = data;
+
+ // Assert
+ Assert.IsNull(view.Data);
+ }
+ }
+
+ [Test]
+ public void Data_SetToNull_MapDataCleared()
+ {
+ // Setup
+ using (var view = new StabilityPointStructuresFailureMechanismView())
+ {
+ var failureMechanismContext = new StabilityPointStructuresFailureMechanismContext(new StabilityPointStructuresFailureMechanism(), new TestAssessmentSection());
+
+ view.Data = failureMechanismContext;
+
+ // Precondition
+ Assert.AreEqual(7, view.Map.Data.Collection.Count());
+
+ // Call
+ view.Data = null;
+
+ // Assert
+ Assert.IsNull(view.Data);
+ Assert.IsNull(view.Map.Data);
+ }
+ }
+
+ [Test]
+ public void Data_EmptyStabilityPointStructuresFailureMechanismContext_NoMapDataSet()
+ {
+ // Setup
+ using (var view = new StabilityPointStructuresFailureMechanismView())
+ {
+ var failureMechanismContext = new StabilityPointStructuresFailureMechanismContext(new StabilityPointStructuresFailureMechanism(), new TestAssessmentSection());
+
+ // Call
+ view.Data = failureMechanismContext;
+
+ // Assert
+ Assert.AreSame(failureMechanismContext, view.Data);
+ AssertEmptyMapData(view.Map.Data);
+ }
+ }
+
+ [Test]
+ public void Data_StabilityPointStructuresFailureMechanismContext_DataUpdatedToCollectionOfFilledMapData()
+ {
+ // Setup
+ using (var view = new StabilityPointStructuresFailureMechanismView())
+ {
+ var map = (MapControl)view.Controls[0];
+
+ var geometryPoints = new[]
+ {
+ new Point2D(0.0, 0.0),
+ new Point2D(2.0, 0.0),
+ new Point2D(4.0, 4.0),
+ new Point2D(6.0, 4.0)
+ };
+
+ var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase();
+ hydraulicBoundaryDatabase.Locations.Add(new HydraulicBoundaryLocation(1, "test", 1.0, 2.0));
+
+ var referenceLine = new ReferenceLine();
+ referenceLine.SetGeometry(new[]
+ {
+ new Point2D(1.0, 2.0),
+ new Point2D(2.0, 1.0)
+ });
+
+ var assessmentSection = new TestAssessmentSection
+ {
+ HydraulicBoundaryDatabase = hydraulicBoundaryDatabase,
+ ReferenceLine = referenceLine
+ };
+
+ var failureMechanism = new StabilityPointStructuresFailureMechanism();
+ failureMechanism.AddSection(new FailureMechanismSection("A", geometryPoints.Take(2)));
+ failureMechanism.AddSection(new FailureMechanismSection("B", geometryPoints.Skip(1).Take(2)));
+ failureMechanism.AddSection(new FailureMechanismSection("C", geometryPoints.Skip(2).Take(2)));
+
+ failureMechanism.ForeshoreProfiles.Add(new TestForeshoreProfile());
+ failureMechanism.ForeshoreProfiles.Add(new TestForeshoreProfile());
+
+ var failureMechanismContext = new StabilityPointStructuresFailureMechanismContext(failureMechanism, assessmentSection);
+
+ // Call
+ view.Data = failureMechanismContext;
+
+ // Assert
+ Assert.AreSame(failureMechanismContext, view.Data);
+
+ var mapData = map.Data;
+ Assert.IsInstanceOf(mapData);
+
+ var mapDataList = mapData.Collection.ToList();
+ Assert.AreEqual(7, mapDataList.Count);
+ AssertReferenceLineMapData(assessmentSection.ReferenceLine, mapDataList[referenceLineIndex]);
+ AssertFailureMechanismSectionsMapData(failureMechanism.Sections, mapDataList[sectionsIndex]);
+ AssertFailureMechanismSectionsStartPointMapData(failureMechanism.Sections, mapDataList[sectionsStartPointIndex]);
+ AssertFailureMechanismSectionsEndPointMapData(failureMechanism.Sections, mapDataList[sectionsEndPointIndex]);
+ AssertHydraulicBoundaryLocationsMapData(assessmentSection.HydraulicBoundaryDatabase, mapDataList[hydraulicBoundaryDatabaseIndex]);
+ AssertForeshoreProfiles(failureMechanism.ForeshoreProfiles, mapDataList[foreshoreProfilesIndex]);
+ }
+ }
+
+ [Test]
+ public void UpdateObserver_HydraulicBoundaryDatabaseUpdated_MapDataUpdated()
+ {
+ // Setup
+ using (var view = new StabilityPointStructuresFailureMechanismView())
+ {
+ var map = (MapControl)view.Controls[0];
+
+ var hydraulicBoundaryDatabase1 = new HydraulicBoundaryDatabase
+ {
+ Locations =
+ {
+ new HydraulicBoundaryLocation(1, "test1", 1.0, 2.0)
+ }
+ };
+ var hydraulicBoundaryDatabase2 = new HydraulicBoundaryDatabase
+ {
+ Locations =
+ {
+ new HydraulicBoundaryLocation(2, "test2", 2.0, 3.0)
+ }
+ };
+
+ var assessmentSection = new TestAssessmentSection
+ {
+ HydraulicBoundaryDatabase = hydraulicBoundaryDatabase1
+ };
+
+ var failureMechanismContext = new StabilityPointStructuresFailureMechanismContext(new StabilityPointStructuresFailureMechanism(), assessmentSection);
+
+ view.Data = failureMechanismContext;
+
+ var hydraulicBoundaryDatabaseMapData = map.Data.Collection.ElementAt(hydraulicBoundaryDatabaseIndex);
+
+ // Precondition
+ AssertHydraulicBoundaryLocationsMapData(hydraulicBoundaryDatabase1, hydraulicBoundaryDatabaseMapData);
+
+ // Call
+ assessmentSection.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase2;
+ assessmentSection.NotifyObservers();
+
+ // Assert
+ AssertHydraulicBoundaryLocationsMapData(hydraulicBoundaryDatabase2, hydraulicBoundaryDatabaseMapData);
+ }
+ }
+
+ [Test]
+ public void UpdateObserver_ReferenceLineUpdated_MapDataUpdated()
+ {
+ // Setup
+ using (var view = new StabilityPointStructuresFailureMechanismView())
+ {
+ var map = (MapControl)view.Controls[0];
+
+ var points1 = new List
+ {
+ new Point2D(1.0, 2.0),
+ new Point2D(2.0, 1.0)
+ };
+
+ var points2 = new List
+ {
+ new Point2D(2.0, 5.0),
+ new Point2D(4.0, 3.0)
+ };
+
+ var assessmentSection = new TestAssessmentSection
+ {
+ ReferenceLine = new ReferenceLine()
+ };
+ assessmentSection.ReferenceLine.SetGeometry(points1);
+
+ var failureMechanismContext = new StabilityPointStructuresFailureMechanismContext(new StabilityPointStructuresFailureMechanism(), assessmentSection);
+
+ view.Data = failureMechanismContext;
+
+ var referenceLineMapData = map.Data.Collection.ElementAt(referenceLineIndex);
+
+ // Precondition
+ AssertReferenceLineMapData(assessmentSection.ReferenceLine, referenceLineMapData);
+
+ // Call
+ assessmentSection.ReferenceLine.SetGeometry(points2);
+ assessmentSection.NotifyObservers();
+
+ // Assert
+ AssertReferenceLineMapData(assessmentSection.ReferenceLine, referenceLineMapData);
+ }
+ }
+
+ [Test]
+ public void UpdateObserver_FailureMechanismSectionsUpdated_MapDataUpdated()
+ {
+ // Setup
+ using (var view = new StabilityPointStructuresFailureMechanismView())
+ {
+ var map = (MapControl)view.Controls[0];
+
+ var failureMechanism = new StabilityPointStructuresFailureMechanism();
+ var failureMechanismContext = new StabilityPointStructuresFailureMechanismContext(failureMechanism, new TestAssessmentSection());
+
+ view.Data = failureMechanismContext;
+
+ var sectionMapData = (MapLineData)map.Data.Collection.ElementAt(sectionsIndex);
+ var sectionStartsMapData = (MapPointData)map.Data.Collection.ElementAt(sectionsStartPointIndex);
+ var sectionsEndsMapData = (MapPointData)map.Data.Collection.ElementAt(sectionsEndPointIndex);
+
+ // Call
+ failureMechanism.AddSection(new FailureMechanismSection(string.Empty, new[]
+ {
+ new Point2D(1, 2),
+ new Point2D(1, 2)
+ }));
+ failureMechanism.NotifyObservers();
+
+ // Assert
+ AssertFailureMechanismSectionsMapData(failureMechanism.Sections, sectionMapData);
+ AssertFailureMechanismSectionsStartPointMapData(failureMechanism.Sections, sectionStartsMapData);
+ AssertFailureMechanismSectionsEndPointMapData(failureMechanism.Sections, sectionsEndsMapData);
+ }
+ }
+
+ [Test]
+ public void UpdateObserver_ForeshoreProfilesUpdated_MapDataUpdated()
+ {
+ // Setup
+ using (var view = new StabilityPointStructuresFailureMechanismView())
+ {
+ var map = (MapControl)view.Controls[0];
+
+ var failureMechanism = new StabilityPointStructuresFailureMechanism();
+ var failureMechanismContext = new StabilityPointStructuresFailureMechanismContext(failureMechanism, new TestAssessmentSection());
+
+ failureMechanism.ForeshoreProfiles.Add(new TestForeshoreProfile());
+
+ view.Data = failureMechanismContext;
+
+ var foreshoreProfileData = map.Data.Collection.ElementAt(foreshoreProfilesIndex);
+
+ // Precondition
+ AssertForeshoreProfiles(failureMechanism.ForeshoreProfiles, foreshoreProfileData);
+
+ // Call
+ failureMechanism.ForeshoreProfiles.Add(new TestForeshoreProfile());
+ failureMechanism.ForeshoreProfiles.NotifyObservers();
+
+ // Assert
+ AssertForeshoreProfiles(failureMechanism.ForeshoreProfiles, foreshoreProfileData);
+ }
+ }
+
+ [Test]
+ public void UpdateObserver_StructuresUpdated_MapDataUpdated()
+ {
+ // Setup
+ using (var view = new StabilityPointStructuresFailureMechanismView())
+ {
+ var map = (MapControl)view.Controls[0];
+
+ var failureMechanism = new StabilityPointStructuresFailureMechanism();
+ var failureMechanismContext = new StabilityPointStructuresFailureMechanismContext(failureMechanism, new TestAssessmentSection());
+
+ failureMechanism.ForeshoreProfiles.Add(new TestForeshoreProfile());
+
+ view.Data = failureMechanismContext;
+
+ var structuresData = map.Data.Collection.ElementAt(structuresIndex);
+
+ // Precondition
+ AssertStructures(failureMechanism.StabilityPointStructures, structuresData);
+
+ // Call
+ failureMechanism.StabilityPointStructures.Add(new TestStabilityPointStructure());
+ failureMechanism.StabilityPointStructures.NotifyObservers();
+
+ // Assert
+ AssertStructures(failureMechanism.StabilityPointStructures, structuresData);
+ }
+ }
+
+ [Test]
+ public void UpdateObserver_DataUpdated_MapLayersSameOrder()
+ {
+ // Setup
+ const int updatedRefenceLineLayerIndex = referenceLineIndex + 6;
+ const int updatedSectionsLayerIndex = sectionsIndex - 1;
+ const int updateSectionStartLayerIndex = sectionsStartPointIndex - 1;
+ const int updatedSectionEndLayerIndex = sectionsEndPointIndex - 1;
+ const int updatedHydraulicLocationsLayerIndex = hydraulicBoundaryDatabaseIndex - 1;
+ const int updatedForeshoreProfilesLayerIndex = foreshoreProfilesIndex - 1;
+ const int updatedStructuresLayerIndex = structuresIndex- 1;
+
+ using (var view = new StabilityPointStructuresFailureMechanismView())
+ {
+ var map = (MapControl)view.Controls[0];
+
+ var assessmentSection = new TestAssessmentSection();
+ var failureMechanism = new StabilityPointStructuresFailureMechanism();
+ var failureMechanismContext = new StabilityPointStructuresFailureMechanismContext(failureMechanism, assessmentSection);
+
+ view.Data = failureMechanismContext;
+
+ var mapData = map.Data;
+
+ var dataToMove = (MapLineData)map.Data.Collection.ElementAt(referenceLineIndex);
+ mapData.Remove(dataToMove);
+ mapData.Add(dataToMove);
+
+ var mapDataList = mapData.Collection.ToList();
+
+ // Precondition
+ var referenceLineData = (MapLineData)mapDataList[updatedRefenceLineLayerIndex];
+ Assert.AreEqual("Referentielijn", referenceLineData.Name);
+
+ var sectionsData = (MapLineData)mapDataList[updatedSectionsLayerIndex];
+ Assert.AreEqual("Vakindeling", sectionsData.Name);
+
+ var sectionStartsData = (MapPointData)mapDataList[updateSectionStartLayerIndex];
+ Assert.AreEqual("Vakindeling (startpunten)", sectionStartsData.Name);
+
+ var sectionEndsData = (MapPointData)mapDataList[updatedSectionEndLayerIndex];
+ Assert.AreEqual("Vakindeling (eindpunten)", sectionEndsData.Name);
+
+ var hydraulicLocationsData = (MapPointData)mapDataList[updatedHydraulicLocationsLayerIndex];
+ Assert.AreEqual("Hydraulische randvoorwaarden", hydraulicLocationsData.Name);
+
+ var foreshoreProfilesData = (MapLineData)mapDataList[updatedForeshoreProfilesLayerIndex];
+ Assert.AreEqual("Voorlandprofielen", foreshoreProfilesData.Name);
+
+ var structuresData = (MapPointData)mapDataList[updatedStructuresLayerIndex];
+ Assert.AreEqual("Kunstwerken", structuresData.Name);
+
+ var points = new List
+ {
+ new Point2D(2.0, 5.0),
+ new Point2D(4.0, 3.0)
+ };
+ ReferenceLine referenceLine = new ReferenceLine();
+ referenceLine.SetGeometry(points);
+ assessmentSection.ReferenceLine = referenceLine;
+
+ // Call
+ assessmentSection.NotifyObservers();
+
+ // Call
+ var actualReferenceLineData = (MapLineData)mapDataList[updatedRefenceLineLayerIndex];
+ Assert.AreEqual("Referentielijn", actualReferenceLineData.Name);
+
+ var actualSectionsData = (MapLineData)mapDataList[updatedSectionsLayerIndex];
+ Assert.AreEqual("Vakindeling", actualSectionsData.Name);
+
+ var actualSectionStartsData = (MapPointData)mapDataList[updateSectionStartLayerIndex];
+ Assert.AreEqual("Vakindeling (startpunten)", actualSectionStartsData.Name);
+
+ var actualSectionEndsData = (MapPointData)mapDataList[updatedSectionEndLayerIndex];
+ Assert.AreEqual("Vakindeling (eindpunten)", actualSectionEndsData.Name);
+
+ var actualHydraulicLocationsData = (MapPointData)mapDataList[updatedHydraulicLocationsLayerIndex];
+ Assert.AreEqual("Hydraulische randvoorwaarden", actualHydraulicLocationsData.Name);
+
+ var actualForeshoreProfilesData = (MapLineData)mapDataList[updatedForeshoreProfilesLayerIndex];
+ Assert.AreEqual("Voorlandprofielen", actualForeshoreProfilesData.Name);
+
+ var actualStructuresData = (MapPointData)mapDataList[updatedStructuresLayerIndex];
+ Assert.AreEqual("Kunstwerken", actualStructuresData.Name);
+ }
+ }
+
+ [Test]
+ public void NotifyObservers_DataUpdatedNotifyObserversOnOldData_NoUpdateInViewData()
+ {
+ // Setup
+ IAssessmentSection oldAssessmentSection = new TestAssessmentSection();
+ IAssessmentSection newAssessmentSection = new TestAssessmentSection();
+
+ newAssessmentSection.ReferenceLine = new ReferenceLine();
+ newAssessmentSection.ReferenceLine.SetGeometry(new[]
+ {
+ new Point2D(2, 4),
+ new Point2D(3, 4)
+ });
+
+ var oldStabilityPointStructuresFailureMechanismContext = new StabilityPointStructuresFailureMechanismContext(new StabilityPointStructuresFailureMechanism(), oldAssessmentSection);
+ var newStabilityPointStructuresFailureMechanismContext = new StabilityPointStructuresFailureMechanismContext(new StabilityPointStructuresFailureMechanism(), newAssessmentSection);
+ using (var view = new StabilityPointStructuresFailureMechanismView())
+ {
+ var map = (MapControl)view.Controls[0];
+
+ view.Data = oldStabilityPointStructuresFailureMechanismContext;
+ view.Data = newStabilityPointStructuresFailureMechanismContext;
+ MapData dataBeforeUpdate = map.Data;
+
+ newAssessmentSection.ReferenceLine.SetGeometry(Enumerable.Empty());
+
+ // Call
+ oldAssessmentSection.NotifyObservers();
+
+ // Assert
+ Assert.AreEqual(dataBeforeUpdate, map.Data);
+ }
+ }
+
+ private static void AssertReferenceLineMapData(ReferenceLine referenceLine, MapData mapData)
+ {
+ Assert.IsInstanceOf(mapData);
+ var referenceLineData = (MapLineData)mapData;
+ if (referenceLine == null)
+ {
+ CollectionAssert.IsEmpty(referenceLineData.Features.First().MapGeometries.First().PointCollections.First());
+ }
+ else
+ {
+ CollectionAssert.AreEqual(referenceLine.Points, referenceLineData.Features.First().MapGeometries.First().PointCollections.First());
+ }
+ Assert.AreEqual("Referentielijn", mapData.Name);
+ }
+
+ private static void AssertForeshoreProfiles(IEnumerable foreshoreProfiles, MapData mapData)
+ {
+ Assert.NotNull(foreshoreProfiles, "foreshoreProfiles should never be null.");
+
+ var foreshoreProfilesData = (MapLineData)mapData;
+ var foreshoreProfileArray = foreshoreProfiles.ToArray();
+
+ Assert.AreEqual(foreshoreProfileArray.Length, foreshoreProfilesData.Features.Length);
+
+ for (int i = 0; i < foreshoreProfileArray.Length; i++)
+ {
+ var profileDataA = foreshoreProfilesData.Features.ElementAt(i).MapGeometries.First();
+ CollectionAssert.AreEquivalent(foreshoreProfileArray[0].Geometry, profileDataA.PointCollections.First());
+ }
+
+ Assert.AreEqual("Voorlandprofielen", mapData.Name);
+ }
+
+ private static void AssertStructures(IEnumerable structures, MapData mapData)
+ {
+ Assert.NotNull(structures, "structures should never be null.");
+
+ var structuresData = (MapPointData)mapData;
+ var structuresArray = structures.ToArray();
+
+ Assert.AreEqual(structuresArray.Length, structuresData.Features.Length);
+
+ for (int i = 0; i < structuresArray.Length; i++)
+ {
+ var profileDataA = structuresData.Features.ElementAt(i).MapGeometries.First();
+ Assert.AreEqual(structuresArray[0].Location, profileDataA.PointCollections.First().First());
+ }
+
+ Assert.AreEqual("Kunstwerken", mapData.Name);
+ }
+
+ private static void AssertHydraulicBoundaryLocationsMapData(HydraulicBoundaryDatabase database, MapData mapData)
+ {
+ Assert.IsInstanceOf(mapData);
+ var hydraulicLocationsMapData = (MapPointData)mapData;
+ if (database == null)
+ {
+ CollectionAssert.IsEmpty(hydraulicLocationsMapData.Features.First().MapGeometries.First().PointCollections.First());
+ }
+ else
+ {
+ CollectionAssert.AreEqual(database.Locations.Select(hrp => hrp.Location), hydraulicLocationsMapData.Features.First().MapGeometries.First().PointCollections.First());
+ }
+ Assert.AreEqual("Hydraulische randvoorwaarden", mapData.Name);
+ }
+
+ private static void AssertFailureMechanismSectionsMapData(IEnumerable sections, MapData mapData)
+ {
+ Assert.IsInstanceOf(mapData);
+ var sectionsMapLinesData = (MapLineData)mapData;
+ var sectionMapLinesFeatures = sectionsMapLinesData.Features.ToArray();
+ Assert.AreEqual(1, sectionMapLinesFeatures.Length);
+
+ var geometries = sectionMapLinesFeatures.First().MapGeometries.ToArray();
+ var sectionsArray = sections.ToArray();
+ Assert.AreEqual(sectionsArray.Length, geometries.Length);
+
+ for (int index = 0; index < sectionsArray.Length; index++)
+ {
+ var failureMechanismSection = sectionsArray[index];
+ CollectionAssert.AreEquivalent(failureMechanismSection.Points, geometries[index].PointCollections.First());
+ }
+ Assert.AreEqual("Vakindeling", mapData.Name);
+ }
+
+ private static void AssertFailureMechanismSectionsStartPointMapData(IEnumerable sections, MapData mapData)
+ {
+ Assert.IsInstanceOf(mapData);
+ var sectionsStartPointData = (MapPointData)mapData;
+ CollectionAssert.AreEqual(sections.Select(s => s.GetStart()), sectionsStartPointData.Features.First().MapGeometries.First().PointCollections.First());
+ Assert.AreEqual("Vakindeling (startpunten)", mapData.Name);
+ }
+
+ private static void AssertFailureMechanismSectionsEndPointMapData(IEnumerable sections, MapData mapData)
+ {
+ Assert.IsInstanceOf(mapData);
+ var sectionsStartPointData = (MapPointData)mapData;
+ CollectionAssert.AreEqual(sections.Select(s => s.GetLast()), sectionsStartPointData.Features.First().MapGeometries.First().PointCollections.First());
+ Assert.AreEqual("Vakindeling (eindpunten)", mapData.Name);
+ }
+
+ private static void AssertEmptyMapData(MapDataCollection mapData)
+ {
+ Assert.IsInstanceOf(mapData);
+
+ var mapDataList = mapData.Collection.ToList();
+
+ Assert.AreEqual(7, mapDataList.Count);
+
+ var referenceLineMapData = (MapLineData)mapDataList[referenceLineIndex];
+ var sectionsMapData = (MapLineData)mapDataList[sectionsIndex];
+ var foreshoreProfilesMapData = (MapLineData)mapDataList[foreshoreProfilesIndex];
+ var structuresMapData = (MapPointData)mapDataList[structuresIndex];
+ var sectionsStartPointMapData = (MapPointData)mapDataList[sectionsStartPointIndex];
+ var sectionsEndPointMapData = (MapPointData)mapDataList[sectionsEndPointIndex];
+ var hydraulicBoundaryDatabaseMapData = (MapPointData)mapDataList[hydraulicBoundaryDatabaseIndex];
+
+ CollectionAssert.IsEmpty(referenceLineMapData.Features);
+ CollectionAssert.IsEmpty(sectionsMapData.Features);
+ CollectionAssert.IsEmpty(foreshoreProfilesMapData.Features);
+ CollectionAssert.IsEmpty(structuresMapData.Features);
+ CollectionAssert.IsEmpty(sectionsStartPointMapData.Features);
+ CollectionAssert.IsEmpty(sectionsEndPointMapData.Features);
+ CollectionAssert.IsEmpty(hydraulicBoundaryDatabaseMapData.Features);
+
+ Assert.AreEqual(RingtoetsCommonDataResources.ReferenceLine_DisplayName, referenceLineMapData.Name);
+ Assert.AreEqual(RingtoetsCommonFormsResources.FailureMechanism_Sections_DisplayName, sectionsMapData.Name);
+ Assert.AreEqual(GetSectionPointDisplayName(RingtoetsCommonFormsResources.FailureMechanismSections_StartPoints_DisplayName), sectionsStartPointMapData.Name);
+ Assert.AreEqual(GetSectionPointDisplayName(RingtoetsCommonFormsResources.FailureMechanismSections_EndPoints_DisplayName), sectionsEndPointMapData.Name);
+ Assert.AreEqual(RingtoetsCommonDataResources.HydraulicBoundaryConditions_DisplayName, hydraulicBoundaryDatabaseMapData.Name);
+ }
+
+ private static string GetSectionPointDisplayName(string name)
+ {
+ return string.Format("{0} ({1})",
+ RingtoetsCommonFormsResources.FailureMechanism_Sections_DisplayName,
+ name);
+ }
+
+ private class TestAssessmentSection : Observable, IAssessmentSection
+ {
+ public string Id { get; set; }
+ public string Name { get; set; }
+ public string Comments { get; set; }
+ public AssessmentSectionComposition Composition { get; private set; }
+ public ReferenceLine ReferenceLine { get; set; }
+ public FailureMechanismContribution FailureMechanismContribution { get; private set; }
+ public HydraulicBoundaryDatabase HydraulicBoundaryDatabase { get; set; }
+
+ public IEnumerable GetFailureMechanisms()
+ {
+ yield break;
+ }
+
+ public void ChangeComposition(AssessmentSectionComposition newComposition)
+ {
+ throw new NotImplementedException();
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/Ringtoets.StabilityPointStructures.Plugin.Test.csproj
===================================================================
diff -u -r2d5e2d09b0cb1a7f48e1b0a067d332347c89d4a8 -reab8aad1da52fe14404e06a6cc684dd6c391abe4
--- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/Ringtoets.StabilityPointStructures.Plugin.Test.csproj (.../Ringtoets.StabilityPointStructures.Plugin.Test.csproj) (revision 2d5e2d09b0cb1a7f48e1b0a067d332347c89d4a8)
+++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/Ringtoets.StabilityPointStructures.Plugin.Test.csproj (.../Ringtoets.StabilityPointStructures.Plugin.Test.csproj) (revision eab8aad1da52fe14404e06a6cc684dd6c391abe4)
@@ -92,6 +92,10 @@
{D749EE4C-CE50-4C17-BF01-9A953028C126}
Core.Common.TestUtil
+
+ {4a06df0d-5d75-4bad-a95a-a3db9b7c4ad5}
+ Core.Components.Gis.Forms
+
{D4200F43-3F72-4F42-AF0A-8CED416A38EC}
Ringtoets.Common.Data
Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/StabilityPointStructuresPluginTest.cs
===================================================================
diff -u -rc238c8de03e71e09a71c68b6f28fb057ef8a1c4d -reab8aad1da52fe14404e06a6cc684dd6c391abe4
--- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/StabilityPointStructuresPluginTest.cs (.../StabilityPointStructuresPluginTest.cs) (revision c238c8de03e71e09a71c68b6f28fb057ef8a1c4d)
+++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Plugin.Test/StabilityPointStructuresPluginTest.cs (.../StabilityPointStructuresPluginTest.cs) (revision eab8aad1da52fe14404e06a6cc684dd6c391abe4)
@@ -19,6 +19,7 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System.Collections.Generic;
using System.Linq;
using Core.Common.Controls.TreeView;
using Core.Common.Gui;
@@ -27,6 +28,7 @@
using Core.Common.Gui.TestUtil;
using NUnit.Framework;
using Rhino.Mocks;
+using Ringtoets.Common.Data.Calculation;
using Ringtoets.Common.Forms.PresentationObjects;
using Ringtoets.StabilityPointStructures.Data;
using Ringtoets.StabilityPointStructures.Forms.PresentationObjects;
@@ -130,10 +132,24 @@
ViewInfo[] viewInfos = plugin.GetViewInfos().ToArray();
// Assert
- Assert.AreEqual(2, viewInfos.Length);
+ Assert.AreEqual(3, viewInfos.Length);
- Assert.IsTrue(viewInfos.Any(vi => vi.DataType == typeof(FailureMechanismSectionResultContext)));
- Assert.IsTrue(viewInfos.Any(vi => vi.ViewType == typeof(StabilityPointStructuresScenariosView)));
+ PluginTestHelper.AssertViewInfoDefined(
+ viewInfos,
+ typeof(StabilityPointStructuresFailureMechanismContext),
+ typeof(StabilityPointStructuresFailureMechanismView));
+
+ PluginTestHelper.AssertViewInfoDefined(
+ viewInfos,
+ typeof(FailureMechanismSectionResultContext),
+ typeof(IEnumerable),
+ typeof(StabilityPointStructuresFailureMechanismResultView));
+
+ PluginTestHelper.AssertViewInfoDefined(
+ viewInfos,
+ typeof(StabilityPointStructuresScenariosContext),
+ typeof(CalculationGroup),
+ typeof(StabilityPointStructuresScenariosView));
}
}