Fisheye: Tag 28bcfbdfd620734930c60df8d0963b3b4b58fa7a refers to a dead (removed) revision in file `Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/PresentationObjects/CalculationState/ClosingStructuresFailureMechanismContext.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/PresentationObjects/CalculationsState/ClosingStructuresFailureMechanismContext.cs
===================================================================
diff -u
--- Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/PresentationObjects/CalculationsState/ClosingStructuresFailureMechanismContext.cs (revision 0)
+++ Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/PresentationObjects/CalculationsState/ClosingStructuresFailureMechanismContext.cs (revision 28bcfbdfd620734930c60df8d0963b3b4b58fa7a)
@@ -0,0 +1,44 @@
+// Copyright (C) Stichting Deltares 2021. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer 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 Riskeer.ClosingStructures.Data;
+using Riskeer.Common.Data.AssessmentSection;
+using Riskeer.Common.Forms.PresentationObjects;
+
+namespace Riskeer.ClosingStructures.Forms.PresentationObjects.CalculationsState
+{
+ ///
+ /// Presentation object for .
+ ///
+ public class ClosingStructuresFailureMechanismContext : FailureMechanismContext
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The instance
+ /// wrapped by this context object.
+ /// The assessment section which the failure mechanism belongs to.
+ /// Thrown when any parameter is null .
+ public ClosingStructuresFailureMechanismContext(ClosingStructuresFailureMechanism failureMechanism, IAssessmentSection assessmentSection)
+ : base(failureMechanism, assessmentSection) {}
+ }
+}
\ No newline at end of file
Fisheye: Tag 28bcfbdfd620734930c60df8d0963b3b4b58fa7a refers to a dead (removed) revision in file `Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/PropertyClasses/CalculationState/ClosingStructuresFailureMechanismProperties.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/PropertyClasses/CalculationsState/ClosingStructuresFailureMechanismProperties.cs
===================================================================
diff -u
--- Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/PropertyClasses/CalculationsState/ClosingStructuresFailureMechanismProperties.cs (revision 0)
+++ Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/PropertyClasses/CalculationsState/ClosingStructuresFailureMechanismProperties.cs (revision 28bcfbdfd620734930c60df8d0963b3b4b58fa7a)
@@ -0,0 +1,129 @@
+// Copyright (C) Stichting Deltares 2021. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer 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.ComponentModel;
+using Core.Common.Base.Data;
+using Core.Common.Util.Attributes;
+using Core.Gui.Attributes;
+using Riskeer.ClosingStructures.Data;
+using Riskeer.Common.Forms.PropertyClasses;
+using RiskeerCommonFormsResources = Riskeer.Common.Forms.Properties.Resources;
+
+namespace Riskeer.ClosingStructures.Forms.PropertyClasses.CalculationsState
+{
+ ///
+ /// Calculation state related ViewModel of for properties panel.
+ ///
+ public class ClosingStructuresFailureMechanismProperties : ClosingStructuresFailureMechanismPropertiesBase
+ {
+ private const int namePropertyIndex = 1;
+ private const int codePropertyIndex = 2;
+ private const int gravitationalAccelerationPropertyIndex = 3;
+
+ private const int modelFactorOvertoppingFlowPropertyIndex = 4;
+ private const int modelFactorStorageVolumePropertyIndex = 5;
+ private const int modelFactorLongThresholdPropertyIndex = 6;
+ private const int modelFactorInflowVolumePropertyIndex = 7;
+
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The instance to show the properties of.
+ /// Thrown when is null .
+ public ClosingStructuresFailureMechanismProperties(ClosingStructuresFailureMechanism data) : base(data, new ConstructionProperties
+ {
+ NamePropertyIndex = namePropertyIndex,
+ CodePropertyIndex = codePropertyIndex
+ }) {}
+
+ #region General
+
+ [PropertyOrder(gravitationalAccelerationPropertyIndex)]
+ [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_General))]
+ [ResourcesDisplayName(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.GravitationalAcceleration_DisplayName))]
+ [ResourcesDescription(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.GravitationalAcceleration_Description))]
+ public RoundedDouble GravitationalAcceleration
+ {
+ get
+ {
+ return data.GeneralInput.GravitationalAcceleration;
+ }
+ }
+
+ #endregion
+
+ #region Model settings
+
+ [PropertyOrder(modelFactorOvertoppingFlowPropertyIndex)]
+ [TypeConverter(typeof(ExpandableObjectConverter))]
+ [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_ModelSettings))]
+ [ResourcesDisplayName(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.StructuresInputFailureMechanismContext_ModelFactorOvertoppingFlow_DisplayName))]
+ [ResourcesDescription(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.StructuresInputFailureMechanismContext_ModelFactorOvertoppingFlow_Description))]
+ public LogNormalDistributionProperties ModelFactorOvertoppingFlow
+ {
+ get
+ {
+ return new LogNormalDistributionProperties(data.GeneralInput.ModelFactorOvertoppingFlow);
+ }
+ }
+
+ [PropertyOrder(modelFactorStorageVolumePropertyIndex)]
+ [TypeConverter(typeof(ExpandableObjectConverter))]
+ [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_ModelSettings))]
+ [ResourcesDisplayName(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.StructuresInputFailureMechanismContext_ModelFactorStorageVolume_DisplayName))]
+ [ResourcesDescription(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.StructuresInputFailureMechanismContext_ModelFactorStorageVolume_Description))]
+ public LogNormalDistributionProperties ModelFactorStorageVolume
+ {
+ get
+ {
+ return new LogNormalDistributionProperties(data.GeneralInput.ModelFactorStorageVolume);
+ }
+ }
+
+ [PropertyOrder(modelFactorLongThresholdPropertyIndex)]
+ [TypeConverter(typeof(ExpandableObjectConverter))]
+ [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_ModelSettings))]
+ [ResourcesDisplayName(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.StructuresInputFailureMechanismContext_ModelFactorLongThreshold_DisplayName))]
+ [ResourcesDescription(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.StructuresInputFailureMechanismContext_ModelFactorLongThreshold_Description))]
+ public NormalDistributionProperties ModelFactorLongThreshold
+ {
+ get
+ {
+ return new NormalDistributionProperties(data.GeneralInput.ModelFactorLongThreshold);
+ }
+ }
+
+ [PropertyOrder(modelFactorInflowVolumePropertyIndex)]
+ [ResourcesCategory(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.Categories_ModelSettings))]
+ [ResourcesDisplayName(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.StructuresInputFailureMechanismContext_ModelFactorInflowVolume_DisplayName))]
+ [ResourcesDescription(typeof(RiskeerCommonFormsResources), nameof(RiskeerCommonFormsResources.StructuresInputFailureMechanismContext_ModelFactorInflowVolume_Description))]
+ public RoundedDouble ModelFactorInflowVolume
+ {
+ get
+ {
+ return data.GeneralInput.ModelFactorInflowVolume;
+ }
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
Fisheye: Tag 28bcfbdfd620734930c60df8d0963b3b4b58fa7a refers to a dead (removed) revision in file `Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/Views/CalculationState/ClosingStructuresFailureMechanismView.Designer.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 28bcfbdfd620734930c60df8d0963b3b4b58fa7a refers to a dead (removed) revision in file `Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/Views/CalculationState/ClosingStructuresFailureMechanismView.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 28bcfbdfd620734930c60df8d0963b3b4b58fa7a refers to a dead (removed) revision in file `Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/Views/CalculationState/ClosingStructuresFailureMechanismView.resx'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/Views/CalculationsState/ClosingStructuresFailureMechanismView.Designer.cs
===================================================================
diff -u
--- Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/Views/CalculationsState/ClosingStructuresFailureMechanismView.Designer.cs (revision 0)
+++ Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/Views/CalculationsState/ClosingStructuresFailureMechanismView.Designer.cs (revision 28bcfbdfd620734930c60df8d0963b3b4b58fa7a)
@@ -0,0 +1,64 @@
+// Copyright (C) Stichting Deltares 2021. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer 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 Riskeer.ClosingStructures.Forms.Views.CalculationsState
+{
+ partial class ClosingStructuresFailureMechanismView
+ {
+ ///
+ /// 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.riskeerMapControl = new Riskeer.Common.Forms.Views.RiskeerMapControl();
+ this.SuspendLayout();
+ //
+ // riskeerMapControl
+ //
+ this.riskeerMapControl.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.riskeerMapControl.Location = new System.Drawing.Point(0, 0);
+ this.riskeerMapControl.Name = "riskeerMapControl";
+ this.riskeerMapControl.Size = new System.Drawing.Size(150, 150);
+ this.riskeerMapControl.TabIndex = 0;
+ //
+ // ClosingStructuresFailureMechanismView
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.riskeerMapControl);
+ this.Name = "ClosingStructuresFailureMechanismView";
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private Common.Forms.Views.RiskeerMapControl riskeerMapControl;
+ }
+}
Index: Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/Views/CalculationsState/ClosingStructuresFailureMechanismView.cs
===================================================================
diff -u
--- Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/Views/CalculationsState/ClosingStructuresFailureMechanismView.cs (revision 0)
+++ Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/Views/CalculationsState/ClosingStructuresFailureMechanismView.cs (revision 28bcfbdfd620734930c60df8d0963b3b4b58fa7a)
@@ -0,0 +1,276 @@
+// Copyright (C) Stichting Deltares 2021. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer 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.Components.Gis.Data;
+using Core.Components.Gis.Forms;
+using Riskeer.ClosingStructures.Data;
+using Riskeer.Common.Data;
+using Riskeer.Common.Data.AssessmentSection;
+using Riskeer.Common.Data.Calculation;
+using Riskeer.Common.Data.DikeProfiles;
+using Riskeer.Common.Data.Structures;
+using Riskeer.Common.Forms.Factories;
+using Riskeer.Common.Forms.MapLayers;
+using ClosingStructuresDataResources = Riskeer.ClosingStructures.Data.Properties.Resources;
+
+namespace Riskeer.ClosingStructures.Forms.Views.CalculationsState
+{
+ ///
+ /// This class is a view showing map data for a closing structures failure mechanism.
+ ///
+ public partial class ClosingStructuresFailureMechanismView : UserControl, IMapView
+ {
+ private HydraulicBoundaryLocationsMapLayer hydraulicBoundaryLocationsMapLayer;
+
+ private MapLineData referenceLineMapData;
+ private MapLineData foreshoreProfilesMapData;
+ private MapPointData structuresMapData;
+ private MapLineData calculationsMapData;
+
+ private Observer assessmentSectionObserver;
+ private Observer referenceLineObserver;
+ private Observer foreshoreProfilesObserver;
+ private Observer structuresObserver;
+
+ private RecursiveObserver calculationInputObserver;
+ private RecursiveObserver calculationGroupObserver;
+ private RecursiveObserver> calculationObserver;
+ private RecursiveObserver foreshoreProfileObserver;
+ private RecursiveObserver, ClosingStructure> structureObserver;
+
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The failure mechanism to show the data for.
+ /// The assessment section to show the data for.
+ /// Thrown when any parameter is null .
+ public ClosingStructuresFailureMechanismView(ClosingStructuresFailureMechanism failureMechanism,
+ IAssessmentSection assessmentSection)
+ {
+ if (failureMechanism == null)
+ {
+ throw new ArgumentNullException(nameof(failureMechanism));
+ }
+
+ if (assessmentSection == null)
+ {
+ throw new ArgumentNullException(nameof(assessmentSection));
+ }
+
+ InitializeComponent();
+
+ FailureMechanism = failureMechanism;
+ AssessmentSection = assessmentSection;
+ }
+
+ ///
+ /// Gets the failure mechanism.
+ ///
+ public ClosingStructuresFailureMechanism FailureMechanism { get; }
+
+ ///
+ /// Gets the assessment section.
+ ///
+ public IAssessmentSection AssessmentSection { get; }
+
+ public object Data { get; set; }
+
+ public IMapControl Map => riskeerMapControl.MapControl;
+
+ ///
+ /// Gets the .
+ ///
+ protected MapDataCollection MapDataCollection { get; private set; }
+
+ protected override void OnLoad(EventArgs e)
+ {
+ CreateObservers();
+
+ CreateMapData();
+
+ SetAllMapDataFeatures();
+
+ riskeerMapControl.SetAllData(MapDataCollection, AssessmentSection.BackgroundData);
+
+ base.OnLoad(e);
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ hydraulicBoundaryLocationsMapLayer.Dispose();
+
+ assessmentSectionObserver.Dispose();
+ referenceLineObserver.Dispose();
+ foreshoreProfilesObserver.Dispose();
+ foreshoreProfileObserver.Dispose();
+ calculationInputObserver.Dispose();
+ calculationGroupObserver.Dispose();
+ calculationObserver.Dispose();
+ structuresObserver.Dispose();
+ structureObserver.Dispose();
+
+ if (disposing)
+ {
+ components?.Dispose();
+ }
+
+ base.Dispose(disposing);
+ }
+
+ protected virtual void CreateMapData()
+ {
+ hydraulicBoundaryLocationsMapLayer = new HydraulicBoundaryLocationsMapLayer(AssessmentSection);
+
+ MapDataCollection = new MapDataCollection(ClosingStructuresDataResources.ClosingStructuresFailureMechanism_DisplayName);
+ referenceLineMapData = RiskeerMapDataFactory.CreateReferenceLineMapData();
+ foreshoreProfilesMapData = RiskeerMapDataFactory.CreateForeshoreProfileMapData();
+ calculationsMapData = RiskeerMapDataFactory.CreateCalculationsMapData();
+ structuresMapData = RiskeerMapDataFactory.CreateStructuresMapData();
+
+ MapDataCollection.Add(referenceLineMapData);
+ MapDataCollection.Add(hydraulicBoundaryLocationsMapLayer.MapData);
+ MapDataCollection.Add(foreshoreProfilesMapData);
+ MapDataCollection.Add(structuresMapData);
+ MapDataCollection.Add(calculationsMapData);
+ }
+
+ protected virtual void CreateObservers()
+ {
+ assessmentSectionObserver = new Observer(UpdateReferenceLineMapData)
+ {
+ Observable = AssessmentSection
+ };
+ referenceLineObserver = new Observer(UpdateReferenceLineMapData)
+ {
+ Observable = AssessmentSection.ReferenceLine
+ };
+ foreshoreProfilesObserver = new Observer(UpdateForeshoreProfilesMapData)
+ {
+ Observable = FailureMechanism.ForeshoreProfiles
+ };
+ structuresObserver = new Observer(UpdateStructuresMapData)
+ {
+ Observable = FailureMechanism.ClosingStructures
+ };
+
+ calculationInputObserver = new RecursiveObserver(
+ UpdateCalculationsMapData, pcg => pcg.Children.Concat(pcg.Children.OfType>()
+ .Select(pc => pc.InputParameters)))
+ {
+ Observable = FailureMechanism.CalculationsGroup
+ };
+ calculationGroupObserver = new RecursiveObserver(UpdateCalculationsMapData, pcg => pcg.Children)
+ {
+ Observable = FailureMechanism.CalculationsGroup
+ };
+ calculationObserver = new RecursiveObserver>(UpdateCalculationsMapData, pcg => pcg.Children)
+ {
+ Observable = FailureMechanism.CalculationsGroup
+ };
+ foreshoreProfileObserver = new RecursiveObserver(UpdateForeshoreProfilesMapData, coll => coll)
+ {
+ Observable = FailureMechanism.ForeshoreProfiles
+ };
+ structureObserver = new RecursiveObserver, ClosingStructure>(UpdateStructuresMapData, coll => coll)
+ {
+ Observable = FailureMechanism.ClosingStructures
+ };
+ }
+
+ protected virtual void SetAllMapDataFeatures()
+ {
+ SetReferenceLineMapData();
+ SetForeshoreProfilesMapData();
+ SetStructuresMapData();
+ SetCalculationsMapData();
+ }
+
+ #region Calculations MapData
+
+ private void UpdateCalculationsMapData()
+ {
+ SetCalculationsMapData();
+ calculationsMapData.NotifyObservers();
+ }
+
+ private void SetCalculationsMapData()
+ {
+ IEnumerable> calculations =
+ FailureMechanism.CalculationsGroup.GetCalculations().Cast>();
+ calculationsMapData.Features = RiskeerMapDataFeaturesFactory.CreateStructureCalculationsFeatures(calculations);
+ }
+
+ #endregion
+
+ #region AssessmentSection MapData
+
+ private void UpdateReferenceLineMapData()
+ {
+ SetReferenceLineMapData();
+ referenceLineMapData.NotifyObservers();
+ }
+
+ private void SetReferenceLineMapData()
+ {
+ ReferenceLine referenceLine = AssessmentSection.ReferenceLine;
+ referenceLineMapData.Features = RiskeerMapDataFeaturesFactory.CreateReferenceLineFeatures(referenceLine, AssessmentSection.Id, AssessmentSection.Name);
+ }
+
+ #endregion
+
+ #region Structures MapData
+
+ private void UpdateStructuresMapData()
+ {
+ SetStructuresMapData();
+ structuresMapData.NotifyObservers();
+ }
+
+ private void SetStructuresMapData()
+ {
+ IEnumerable structures = FailureMechanism.ClosingStructures;
+ structuresMapData.Features = RiskeerMapDataFeaturesFactory.CreateStructuresFeatures(structures);
+ }
+
+ #endregion
+
+ #region Foreshore Profiles MapData
+
+ private void UpdateForeshoreProfilesMapData()
+ {
+ SetForeshoreProfilesMapData();
+ foreshoreProfilesMapData.NotifyObservers();
+ }
+
+ private void SetForeshoreProfilesMapData()
+ {
+ IEnumerable foreshoreProfiles = FailureMechanism.ForeshoreProfiles;
+ foreshoreProfilesMapData.Features = RiskeerMapDataFeaturesFactory.CreateForeshoreProfilesFeatures(foreshoreProfiles);
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
Index: Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/Views/CalculationsState/ClosingStructuresFailureMechanismView.resx
===================================================================
diff -u
--- Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/Views/CalculationsState/ClosingStructuresFailureMechanismView.resx (revision 0)
+++ Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/Views/CalculationsState/ClosingStructuresFailureMechanismView.resx (revision 28bcfbdfd620734930c60df8d0963b3b4b58fa7a)
@@ -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: Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/Views/RegistrationState/ClosingStructuresFailureMechanismView.cs
===================================================================
diff -u -rc92013504a173b7289b48e3f3163bac19417b531 -r28bcfbdfd620734930c60df8d0963b3b4b58fa7a
--- Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/Views/RegistrationState/ClosingStructuresFailureMechanismView.cs (.../ClosingStructuresFailureMechanismView.cs) (revision c92013504a173b7289b48e3f3163bac19417b531)
+++ Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Forms/Views/RegistrationState/ClosingStructuresFailureMechanismView.cs (.../ClosingStructuresFailureMechanismView.cs) (revision 28bcfbdfd620734930c60df8d0963b3b4b58fa7a)
@@ -36,7 +36,7 @@
///
/// This class is a view showing map data for a closing structures failure mechanism.
///
- public class ClosingStructuresFailureMechanismView : CalculationState.ClosingStructuresFailureMechanismView
+ public class ClosingStructuresFailureMechanismView : CalculationsState.ClosingStructuresFailureMechanismView
{
private MapLineData sectionsMapData;
private MapPointData sectionsStartPointMapData;
Index: Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Plugin/ClosingStructuresPlugin.cs
===================================================================
diff -u -ra831de027adb0c125ef6d740496cf34af84b883b -r28bcfbdfd620734930c60df8d0963b3b4b58fa7a
--- Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Plugin/ClosingStructuresPlugin.cs (.../ClosingStructuresPlugin.cs) (revision a831de027adb0c125ef6d740496cf34af84b883b)
+++ Riskeer/ClosingStructures/src/Riskeer.ClosingStructures.Plugin/ClosingStructuresPlugin.cs (.../ClosingStructuresPlugin.cs) (revision 28bcfbdfd620734930c60df8d0963b3b4b58fa7a)
@@ -60,11 +60,11 @@
using Riskeer.Common.Service;
using Riskeer.Common.Util;
using Riskeer.Common.Util.Helpers;
-using CalculationStateFailureMechanismContext = Riskeer.ClosingStructures.Forms.PresentationObjects.CalculationState.ClosingStructuresFailureMechanismContext;
+using CalculationsStateFailureMechanismContext = Riskeer.ClosingStructures.Forms.PresentationObjects.CalculationsState.ClosingStructuresFailureMechanismContext;
using RegistrationStateFailureMechanismContext = Riskeer.ClosingStructures.Forms.PresentationObjects.RegistrationState.ClosingStructuresFailureMechanismContext;
-using CalculationStateFailureMechanismProperties = Riskeer.ClosingStructures.Forms.PropertyClasses.CalculationState.ClosingStructuresFailureMechanismProperties;
+using CalculationsStateFailureMechanismProperties = Riskeer.ClosingStructures.Forms.PropertyClasses.CalculationsState.ClosingStructuresFailureMechanismProperties;
using RegistrationStateFailureMechanismProperties = Riskeer.ClosingStructures.Forms.PropertyClasses.RegistrationState.ClosingStructuresFailureMechanismProperties;
-using CalculationStateFailureMechanismView = Riskeer.ClosingStructures.Forms.Views.CalculationState.ClosingStructuresFailureMechanismView;
+using CalculationsStateFailureMechanismView = Riskeer.ClosingStructures.Forms.Views.CalculationsState.ClosingStructuresFailureMechanismView;
using RegistrationStateFailureMechanismView = Riskeer.ClosingStructures.Forms.Views.RegistrationState.ClosingStructuresFailureMechanismView;
using RiskeerCommonFormsResources = Riskeer.Common.Forms.Properties.Resources;
using RiskeerCommonDataResources = Riskeer.Common.Data.Properties.Resources;
@@ -79,9 +79,9 @@
{
public override IEnumerable GetPropertyInfos()
{
- yield return new PropertyInfo
+ yield return new PropertyInfo
{
- CreateInstance = context => new CalculationStateFailureMechanismProperties(context.WrappedData)
+ CreateInstance = context => new CalculationsStateFailureMechanismProperties(context.WrappedData)
};
yield return new PropertyInfo
{
@@ -102,10 +102,10 @@
public override IEnumerable GetViewInfos()
{
- yield return new RiskeerViewInfo(() => Gui)
+ yield return new RiskeerViewInfo(() => Gui)
{
GetViewName = (view, context) => context.WrappedData.Name,
- CreateInstance = context => new CalculationStateFailureMechanismView(context.WrappedData, context.Parent)
+ CreateInstance = context => new CalculationsStateFailureMechanismView(context.WrappedData, context.Parent)
};
yield return new RiskeerViewInfo(() => Gui)
@@ -149,7 +149,7 @@
public override IEnumerable GetTreeNodeInfos()
{
- yield return RiskeerTreeNodeInfoFactory.CreateFailureMechanismStateContextTreeNodeInfo(
+ yield return RiskeerTreeNodeInfoFactory.CreateFailureMechanismStateContextTreeNodeInfo(
CalculationStateFailureMechanismChildNodeObjects,
CalculationStateFailureMechanismContextMenuStrip);
@@ -346,7 +346,7 @@
{
ClosingStructuresFailureMechanism failureMechanism = null;
- if (dataToCloseFor is CalculationStateFailureMechanismContext failureMechanismContext)
+ if (dataToCloseFor is CalculationsStateFailureMechanismContext failureMechanismContext)
{
failureMechanism = failureMechanismContext.WrappedData;
}
@@ -367,7 +367,7 @@
#region CalculationStateFailureMechanismContext TreeNodeInfo
- private static object[] CalculationStateFailureMechanismChildNodeObjects(CalculationStateFailureMechanismContext context)
+ private static object[] CalculationStateFailureMechanismChildNodeObjects(CalculationsStateFailureMechanismContext context)
{
ClosingStructuresFailureMechanism failureMechanism = context.WrappedData;
IAssessmentSection assessmentSection = context.Parent;
@@ -390,7 +390,7 @@
};
}
- private ContextMenuStrip CalculationStateFailureMechanismContextMenuStrip(CalculationStateFailureMechanismContext context,
+ private ContextMenuStrip CalculationStateFailureMechanismContextMenuStrip(CalculationsStateFailureMechanismContext context,
object parentData,
TreeViewControl treeViewControl)
{
@@ -423,18 +423,18 @@
.Build();
}
- private static string EnableValidateAndCalculateMenuItemForFailureMechanism(CalculationStateFailureMechanismContext context)
+ private static string EnableValidateAndCalculateMenuItemForFailureMechanism(CalculationsStateFailureMechanismContext context)
{
return EnableValidateAndCalculateMenuItem(context.Parent);
}
- private static void ValidateAllInFailureMechanism(CalculationStateFailureMechanismContext context)
+ private static void ValidateAllInFailureMechanism(CalculationsStateFailureMechanismContext context)
{
ValidateAll(context.WrappedData.Calculations.OfType>(),
context.Parent);
}
- private void CalculateAllInFailureMechanism(CalculationStateFailureMechanismContext context)
+ private void CalculateAllInFailureMechanism(CalculationsStateFailureMechanismContext context)
{
ActivityProgressDialogRunner.Run(Gui.MainWindow,
ClosingStructuresCalculationActivityFactory.CreateCalculationActivities(context.WrappedData, context.Parent));
Fisheye: Tag 28bcfbdfd620734930c60df8d0963b3b4b58fa7a refers to a dead (removed) revision in file `Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Forms.Test/PresentationObjects/CalculationState/ClosingStructuresFailureMechanismContextTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Forms.Test/PresentationObjects/CalculationsState/ClosingStructuresFailureMechanismContextTest.cs
===================================================================
diff -u
--- Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Forms.Test/PresentationObjects/CalculationsState/ClosingStructuresFailureMechanismContextTest.cs (revision 0)
+++ Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Forms.Test/PresentationObjects/CalculationsState/ClosingStructuresFailureMechanismContextTest.cs (revision 28bcfbdfd620734930c60df8d0963b3b4b58fa7a)
@@ -0,0 +1,54 @@
+// Copyright (C) Stichting Deltares 2021. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer 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 NUnit.Framework;
+using Rhino.Mocks;
+using Riskeer.ClosingStructures.Data;
+using Riskeer.ClosingStructures.Forms.PresentationObjects.CalculationsState;
+using Riskeer.Common.Data.AssessmentSection;
+using Riskeer.Common.Forms.PresentationObjects;
+
+namespace Riskeer.ClosingStructures.Forms.Test.PresentationObjects.CalculationsState
+{
+ [TestFixture]
+ public class ClosingStructuresFailureMechanismContextTest
+ {
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new ClosingStructuresFailureMechanism();
+
+ // Call
+ var context = new ClosingStructuresFailureMechanismContext(failureMechanism, assessmentSection);
+
+ // Assert
+ Assert.IsInstanceOf>(context);
+ Assert.AreSame(assessmentSection, context.Parent);
+ Assert.AreSame(failureMechanism, context.WrappedData);
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 28bcfbdfd620734930c60df8d0963b3b4b58fa7a refers to a dead (removed) revision in file `Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Forms.Test/PropertyClasses/CalculationState/ClosingStructuresFailureMechanismPropertiesTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Forms.Test/PropertyClasses/CalculationsState/ClosingStructuresFailureMechanismPropertiesTest.cs
===================================================================
diff -u
--- Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Forms.Test/PropertyClasses/CalculationsState/ClosingStructuresFailureMechanismPropertiesTest.cs (revision 0)
+++ Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Forms.Test/PropertyClasses/CalculationsState/ClosingStructuresFailureMechanismPropertiesTest.cs (revision 28bcfbdfd620734930c60df8d0963b3b4b58fa7a)
@@ -0,0 +1,149 @@
+// Copyright (C) Stichting Deltares 2021. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer 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.ComponentModel;
+using Core.Gui.TestUtil;
+using NUnit.Framework;
+using Riskeer.ClosingStructures.Data;
+using Riskeer.ClosingStructures.Forms.PropertyClasses;
+using Riskeer.ClosingStructures.Forms.PropertyClasses.CalculationsState;
+
+namespace Riskeer.ClosingStructures.Forms.Test.PropertyClasses.CalculationsState
+{
+ [TestFixture]
+ public class ClosingStructuresFailureMechanismPropertiesTest
+ {
+ private const int namePropertyIndex = 0;
+ private const int codePropertyIndex = 1;
+ private const int gravitationalAccelerationPropertyIndex = 2;
+
+ private const int modelFactorOvertoppingFlowPropertyIndex = 3;
+ private const int modelFactorStorageVolumePropertyIndex = 4;
+ private const int modelFactorLongThresholdPropertyIndex = 5;
+ private const int modelFactorInflowVolumePropertyIndex = 6;
+
+ [Test]
+ public void Constructor_DataNull_ThrowArgumentNullException()
+ {
+ // Call
+ void Call() => new ClosingStructuresFailureMechanismProperties(null);
+
+ // Assert
+ string paramName = Assert.Throws(Call).ParamName;
+ Assert.AreEqual("data", paramName);
+ }
+
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Setup
+ var failureMechanism = new ClosingStructuresFailureMechanism();
+
+ // Call
+ var properties = new ClosingStructuresFailureMechanismProperties(failureMechanism);
+
+ // Assert
+ Assert.IsInstanceOf(properties);
+ Assert.AreSame(failureMechanism, properties.Data);
+ Assert.AreEqual(failureMechanism.Name, properties.Name);
+ Assert.AreEqual(failureMechanism.Code, properties.Code);
+
+ GeneralClosingStructuresInput generalInput = failureMechanism.GeneralInput;
+ Assert.AreEqual(generalInput.GravitationalAcceleration,
+ properties.GravitationalAcceleration);
+
+ Assert.AreEqual(generalInput.ModelFactorOvertoppingFlow.Mean, properties.ModelFactorOvertoppingFlow.Mean);
+ Assert.AreEqual(generalInput.ModelFactorOvertoppingFlow.StandardDeviation, properties.ModelFactorOvertoppingFlow.StandardDeviation);
+ Assert.AreEqual(generalInput.ModelFactorStorageVolume.Mean, properties.ModelFactorStorageVolume.Mean);
+ Assert.AreEqual(generalInput.ModelFactorStorageVolume.StandardDeviation, properties.ModelFactorStorageVolume.StandardDeviation);
+ Assert.AreEqual(generalInput.ModelFactorLongThreshold.Mean, properties.ModelFactorLongThreshold.Mean);
+ Assert.AreEqual(generalInput.ModelFactorLongThreshold.StandardDeviation, properties.ModelFactorLongThreshold.StandardDeviation);
+ Assert.AreEqual(generalInput.ModelFactorInflowVolume, properties.ModelFactorInflowVolume);
+ }
+
+ [Test]
+ public void Constructor_Always_PropertiesHaveExpectedAttributeValues()
+ {
+ // Call
+ var properties = new ClosingStructuresFailureMechanismProperties(new ClosingStructuresFailureMechanism());
+
+ // Assert
+ const string generalCategory = "Algemeen";
+ const string modelSettingsCategory = "Modelinstellingen";
+
+ PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties);
+ Assert.AreEqual(7, dynamicProperties.Count);
+
+ PropertyDescriptor nameProperty = dynamicProperties[namePropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(nameProperty,
+ generalCategory,
+ "Naam",
+ "De naam van het faalmechanisme.",
+ true);
+
+ PropertyDescriptor codeProperty = dynamicProperties[codePropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(codeProperty,
+ generalCategory,
+ "Label",
+ "Het label van het faalmechanisme.",
+ true);
+
+ PropertyDescriptor gravitationalAccelerationProperty = dynamicProperties[gravitationalAccelerationPropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(gravitationalAccelerationProperty,
+ generalCategory,
+ "Valversnelling [m/s²]",
+ "Valversnelling.",
+ true);
+
+ PropertyDescriptor modelFactorOvertoppingFlowProperty = dynamicProperties[modelFactorOvertoppingFlowPropertyIndex];
+ Assert.IsInstanceOf(modelFactorOvertoppingFlowProperty.Converter);
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(modelFactorOvertoppingFlowProperty,
+ modelSettingsCategory,
+ "Modelfactor overslagdebiet [-]",
+ "Modelfactor voor het overslagdebiet.",
+ true);
+
+ PropertyDescriptor modelFactorStorageVolumeProperty = dynamicProperties[modelFactorStorageVolumePropertyIndex];
+ Assert.IsInstanceOf(modelFactorStorageVolumeProperty.Converter);
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(modelFactorStorageVolumeProperty,
+ modelSettingsCategory,
+ "Modelfactor kombergend vermogen [-]",
+ "Modelfactor kombergend vermogen.",
+ true);
+
+ PropertyDescriptor modelFactorLongThresholdProperty = dynamicProperties[modelFactorLongThresholdPropertyIndex];
+ Assert.IsInstanceOf(modelFactorLongThresholdProperty.Converter);
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(modelFactorLongThresholdProperty,
+ modelSettingsCategory,
+ "Modelfactor lange overlaat [-]",
+ "Modelfactor voor een lange overlaat.",
+ true);
+
+ PropertyDescriptor modelFactorInflowVolumeProperty = dynamicProperties[modelFactorInflowVolumePropertyIndex];
+ PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(modelFactorInflowVolumeProperty,
+ modelSettingsCategory,
+ "Modelfactor instromend volume [-]",
+ "Modelfactor instromend volume.",
+ true);
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 28bcfbdfd620734930c60df8d0963b3b4b58fa7a refers to a dead (removed) revision in file `Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Forms.Test/Views/CalculationState/ClosingStructuresFailureMechanismViewTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Forms.Test/Views/CalculationsState/ClosingStructuresFailureMechanismViewTest.cs
===================================================================
diff -u
--- Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Forms.Test/Views/CalculationsState/ClosingStructuresFailureMechanismViewTest.cs (revision 0)
+++ Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Forms.Test/Views/CalculationsState/ClosingStructuresFailureMechanismViewTest.cs (revision 28bcfbdfd620734930c60df8d0963b3b4b58fa7a)
@@ -0,0 +1,734 @@
+// Copyright (C) Stichting Deltares 2021. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer 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.Threading;
+using System.Windows.Forms;
+using Core.Common.Base;
+using Core.Common.Base.Geometry;
+using Core.Components.Gis.Data;
+using Core.Components.Gis.Features;
+using Core.Components.Gis.Forms;
+using Core.Components.Gis.Geometries;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Riskeer.ClosingStructures.Data;
+using Riskeer.ClosingStructures.Data.TestUtil;
+using Riskeer.ClosingStructures.Forms.Views.CalculationsState;
+using Riskeer.Common.Data.AssessmentSection;
+using Riskeer.Common.Data.FailureMechanism;
+using Riskeer.Common.Data.Hydraulics;
+using Riskeer.Common.Data.Structures;
+using Riskeer.Common.Data.TestUtil;
+using Riskeer.Common.Forms.TestUtil;
+using Riskeer.Common.Forms.Views;
+
+namespace Riskeer.ClosingStructures.Forms.Test.Views.CalculationsState
+{
+ [TestFixture]
+ public class ClosingStructuresFailureMechanismViewTest
+ {
+ private const int referenceLineIndex = 0;
+ private const int hydraulicBoundaryLocationsIndex = 1;
+ private const int foreshoreProfilesIndex = 2;
+ private const int structuresIndex = 3;
+ private const int calculationsIndex = 4;
+
+ private const int foreshoreProfilesObserverIndex = 1;
+ private const int structuresObserverIndex = 2;
+ private const int calculationObserverIndex = 3;
+
+ private Form testForm;
+
+ [SetUp]
+ public void Setup()
+ {
+ testForm = new Form();
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ testForm.Dispose();
+ }
+
+ [Test]
+ public void Constructor_FailureMechanismNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ // Call
+ void Call() => new ClosingStructuresFailureMechanismView(null, assessmentSection);
+
+ // Assert
+ var exception = Assert.Throws(Call);
+ Assert.AreEqual("failureMechanism", exception.ParamName);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Constructor_AssessmentSectionNull_ThrowsArgumentNullException()
+ {
+ // Call
+ void Call() => new ClosingStructuresFailureMechanismView(new ClosingStructuresFailureMechanism(), null);
+
+ // Assert
+ var exception = Assert.Throws(Call);
+ Assert.AreEqual("assessmentSection", exception.ParamName);
+ }
+
+ [Test]
+ [Apartment(ApartmentState.STA)]
+ public void Constructor_ExpectedValues()
+ {
+ // Setup
+ var failureMechanism = new ClosingStructuresFailureMechanism();
+ var assessmentSection = new AssessmentSectionStub();
+
+ // Call
+ ClosingStructuresFailureMechanismView view = CreateView(failureMechanism, assessmentSection);
+
+ // Assert
+ Assert.IsInstanceOf(view);
+ Assert.IsInstanceOf(view);
+ Assert.IsNull(view.Data);
+ Assert.AreSame(failureMechanism, view.FailureMechanism);
+ Assert.AreSame(assessmentSection, view.AssessmentSection);
+
+ Assert.AreEqual(1, view.Controls.Count);
+ Assert.IsInstanceOf(view.Controls[0]);
+ Assert.AreSame(view.Map, ((RiskeerMapControl) view.Controls[0]).MapControl);
+ Assert.AreEqual(DockStyle.Fill, ((Control) view.Map).Dock);
+ AssertEmptyMapData(view.Map.Data);
+ }
+
+ [Test]
+ [Apartment(ApartmentState.STA)]
+ public void Constructor_AssessmentSectionWithBackgroundData_BackgroundDataSet()
+ {
+ // Setup
+ IAssessmentSection assessmentSection = new AssessmentSectionStub();
+
+ // Call
+ ClosingStructuresFailureMechanismView view = CreateView(new ClosingStructuresFailureMechanism(), assessmentSection);
+
+ // Assert
+ MapDataTestHelper.AssertImageBasedMapData(assessmentSection.BackgroundData, view.Map.BackgroundMapData);
+ }
+
+ [Test]
+ [Apartment(ApartmentState.STA)]
+ public void Constructor_WithAllData_DataUpdatedToCollectionOfFilledMapData()
+ {
+ // Setup
+ var calculationA = new StructuresCalculationScenario
+ {
+ InputParameters =
+ {
+ HydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, string.Empty, 1.3, 2.3),
+ Structure = new TestClosingStructure(new Point2D(1.2, 2.3))
+ }
+ };
+
+ var calculationB = new StructuresCalculationScenario
+ {
+ InputParameters =
+ {
+ HydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, string.Empty, 7.7, 12.6),
+ Structure = new TestClosingStructure(new Point2D(2.7, 2.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 failureMechanism = new ClosingStructuresFailureMechanism();
+ FailureMechanismTestHelper.SetSections(failureMechanism, new[]
+ {
+ new FailureMechanismSection("A", geometryPoints.Take(2)),
+ new FailureMechanismSection("B", geometryPoints.Skip(1).Take(2)),
+ new FailureMechanismSection("C", geometryPoints.Skip(2).Take(2))
+ });
+
+ var profile1 = new TestForeshoreProfile("profile1 ID", new[]
+ {
+ new Point2D(0, 0),
+ new Point2D(1, 1)
+ });
+ var profile2 = new TestForeshoreProfile("profile2 ID", new[]
+ {
+ new Point2D(2, 2),
+ new Point2D(3, 3)
+ });
+ failureMechanism.ForeshoreProfiles.AddRange(new[]
+ {
+ profile1,
+ profile2
+ }, "path");
+ failureMechanism.CalculationsGroup.Children.Add(calculationA);
+ failureMechanism.CalculationsGroup.Children.Add(calculationB);
+
+ var referenceLine = new ReferenceLine();
+ referenceLine.SetGeometry(new[]
+ {
+ new Point2D(1.0, 2.0),
+ new Point2D(2.0, 1.0)
+ });
+
+ var assessmentSection = new AssessmentSectionStub
+ {
+ ReferenceLine = referenceLine
+ };
+ assessmentSection.SetHydraulicBoundaryLocationCalculations(new[]
+ {
+ new HydraulicBoundaryLocation(1, "test", 1.0, 2.0)
+ });
+
+ // Call
+ ClosingStructuresFailureMechanismView view = CreateView(failureMechanism, assessmentSection);
+
+ IMapControl map = ((RiskeerMapControl) view.Controls[0]).MapControl;
+
+ // Assert
+ MapDataCollection mapData = map.Data;
+ Assert.IsInstanceOf(mapData);
+
+ List mapDataList = mapData.Collection.ToList();
+ Assert.AreEqual(5, mapDataList.Count);
+ MapDataTestHelper.AssertReferenceLineMapData(assessmentSection.ReferenceLine, mapDataList[referenceLineIndex]);
+
+ MapDataTestHelper.AssertHydraulicBoundaryLocationsMapData(assessmentSection, mapDataList[hydraulicBoundaryLocationsIndex]);
+ MapDataTestHelper.AssertForeshoreProfilesMapData(failureMechanism.ForeshoreProfiles, mapDataList[foreshoreProfilesIndex]);
+ AssertCalculationsMapData(
+ failureMechanism.Calculations.Cast>(),
+ mapDataList[calculationsIndex]);
+ }
+
+ [Test]
+ [Apartment(ApartmentState.STA)]
+ public void GivenViewWithAssessmentSectionData_WhenAssessmentSectionUpdatedAndNotified_ThenMapDataUpdated()
+ {
+ // Given
+ var referenceLine = new ReferenceLine();
+ referenceLine.SetGeometry(new List
+ {
+ new Point2D(1.0, 2.0),
+ new Point2D(2.0, 1.0)
+ });
+ var assessmentSection = new AssessmentSectionStub
+ {
+ ReferenceLine = referenceLine
+ };
+
+ ClosingStructuresFailureMechanismView view = CreateView(new ClosingStructuresFailureMechanism(), assessmentSection);
+
+ IMapControl map = ((RiskeerMapControl) view.Controls[0]).MapControl;
+
+ var mocks = new MockRepository();
+ IObserver[] observers = AttachMapDataObservers(mocks, map.Data.Collection);
+ observers[referenceLineIndex].Expect(obs => obs.UpdateObserver());
+ mocks.ReplayAll();
+
+ var referenceLineMapData = (MapLineData) map.Data.Collection.ElementAt(referenceLineIndex);
+
+ // Precondition
+ MapFeaturesTestHelper.AssertReferenceLineMetaData(assessmentSection.ReferenceLine, assessmentSection, referenceLineMapData.Features);
+
+ // When
+ assessmentSection.Name = "New name";
+ assessmentSection.NotifyObservers();
+
+ // Then
+ MapFeaturesTestHelper.AssertReferenceLineMetaData(assessmentSection.ReferenceLine, assessmentSection, referenceLineMapData.Features);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ [Apartment(ApartmentState.STA)]
+ public void GivenViewWithReferenceLineData_WhenReferenceLineUpdatedAndNotified_ThenMapDataUpdated()
+ {
+ // Given
+ var referenceLine = new ReferenceLine();
+ referenceLine.SetGeometry(new List
+ {
+ new Point2D(1.0, 2.0),
+ new Point2D(2.0, 1.0)
+ });
+ var assessmentSection = new AssessmentSectionStub
+ {
+ ReferenceLine = referenceLine
+ };
+
+ ClosingStructuresFailureMechanismView view = CreateView(new ClosingStructuresFailureMechanism(), assessmentSection);
+
+ IMapControl map = ((RiskeerMapControl) view.Controls[0]).MapControl;
+
+ var mocks = new MockRepository();
+ IObserver[] observers = AttachMapDataObservers(mocks, map.Data.Collection);
+ observers[referenceLineIndex].Expect(obs => obs.UpdateObserver());
+ mocks.ReplayAll();
+
+ MapData referenceLineMapData = map.Data.Collection.ElementAt(referenceLineIndex);
+
+ // Precondition
+ MapDataTestHelper.AssertReferenceLineMapData(assessmentSection.ReferenceLine, referenceLineMapData);
+
+ // When
+ referenceLine.SetGeometry(new List
+ {
+ new Point2D(2.0, 5.0),
+ new Point2D(4.0, 3.0)
+ });
+ referenceLine.NotifyObservers();
+
+ // Then
+ MapDataTestHelper.AssertReferenceLineMapData(assessmentSection.ReferenceLine, referenceLineMapData);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ [Apartment(ApartmentState.STA)]
+ public void GivenViewWithForeshoreProfileData_WhenForeshoreProfileUpdatedAndNotified_ThenMapDataUpdated()
+ {
+ // Given
+ var foreshoreProfile = new TestForeshoreProfile("originalProfile ID", new[]
+ {
+ new Point2D(0, 0),
+ new Point2D(1, 1)
+ });
+ var failureMechanism = new ClosingStructuresFailureMechanism();
+ failureMechanism.ForeshoreProfiles.AddRange(new[]
+ {
+ foreshoreProfile
+ }, "path");
+
+ ClosingStructuresFailureMechanismView view = CreateView(failureMechanism, new AssessmentSectionStub());
+
+ IMapControl map = ((RiskeerMapControl) view.Controls[0]).MapControl;
+
+ var mocks = new MockRepository();
+ IObserver[] observers = AttachMapDataObservers(mocks, map.Data.Collection);
+ observers[foreshoreProfilesObserverIndex].Expect(obs => obs.UpdateObserver());
+ mocks.ReplayAll();
+
+ MapData foreshoreProfileData = map.Data.Collection.ElementAt(foreshoreProfilesIndex);
+
+ // Precondition
+ MapDataTestHelper.AssertForeshoreProfilesMapData(failureMechanism.ForeshoreProfiles, foreshoreProfileData);
+
+ // When
+ var foreshoreProfileToUpdateFrom = new TestForeshoreProfile("originalProfile ID", new[]
+ {
+ new Point2D(2, 2),
+ new Point2D(3, 3)
+ });
+ foreshoreProfile.CopyProperties(foreshoreProfileToUpdateFrom);
+ foreshoreProfile.NotifyObservers();
+
+ // Then
+ MapDataTestHelper.AssertForeshoreProfilesMapData(failureMechanism.ForeshoreProfiles, foreshoreProfileData);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ [Apartment(ApartmentState.STA)]
+ public void GivenViewWithForeshoreProfilesData_WhenForeshoreProfilesUpdatedAndNotified_ThenMapDataUpdated()
+ {
+ // Given
+ var failureMechanism = new ClosingStructuresFailureMechanism();
+ failureMechanism.ForeshoreProfiles.AddRange(new[]
+ {
+ new TestForeshoreProfile("originalProfile ID", new[]
+ {
+ new Point2D(0, 0),
+ new Point2D(1, 1)
+ })
+ }, "path");
+
+ ClosingStructuresFailureMechanismView view = CreateView(failureMechanism, new AssessmentSectionStub());
+
+ IMapControl map = ((RiskeerMapControl) view.Controls[0]).MapControl;
+
+ var mocks = new MockRepository();
+ IObserver[] observers = AttachMapDataObservers(mocks, map.Data.Collection);
+ observers[foreshoreProfilesObserverIndex].Expect(obs => obs.UpdateObserver());
+ mocks.ReplayAll();
+
+ MapData foreshoreProfileData = map.Data.Collection.ElementAt(foreshoreProfilesIndex);
+
+ // Precondition
+ MapDataTestHelper.AssertForeshoreProfilesMapData(failureMechanism.ForeshoreProfiles, foreshoreProfileData);
+
+ // When
+ failureMechanism.ForeshoreProfiles.AddRange(new[]
+ {
+ new TestForeshoreProfile("newProfile ID", new[]
+ {
+ new Point2D(2, 2),
+ new Point2D(3, 3)
+ })
+ }, "path");
+ failureMechanism.ForeshoreProfiles.NotifyObservers();
+
+ // Then
+ MapDataTestHelper.AssertForeshoreProfilesMapData(failureMechanism.ForeshoreProfiles, foreshoreProfileData);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ [Apartment(ApartmentState.STA)]
+ public void GivenViewWithStructureData_WhenStructureUpdatedAndNotified_ThenMapDataUpdated()
+ {
+ // Given
+ var structure = new TestClosingStructure(new Point2D(0, 0), "Id");
+ var failureMechanism = new ClosingStructuresFailureMechanism();
+ failureMechanism.ClosingStructures.AddRange(new[]
+ {
+ structure
+ }, "path");
+
+ ClosingStructuresFailureMechanismView view = CreateView(failureMechanism, new AssessmentSectionStub());
+
+ IMapControl map = ((RiskeerMapControl) view.Controls[0]).MapControl;
+
+ var mocks = new MockRepository();
+ IObserver[] observers = AttachMapDataObservers(mocks, map.Data.Collection);
+ observers[structuresObserverIndex].Expect(obs => obs.UpdateObserver());
+ mocks.ReplayAll();
+
+ MapData structuresData = map.Data.Collection.ElementAt(structuresIndex);
+
+ // Precondition
+ MapDataTestHelper.AssertStructuresMapData(failureMechanism.ClosingStructures,
+ structuresData);
+
+ // When
+ structure.CopyProperties(new TestClosingStructure(new Point2D(1, 1), "Id"));
+ structure.NotifyObservers();
+
+ // Then
+ MapDataTestHelper.AssertStructuresMapData(failureMechanism.ClosingStructures,
+ structuresData);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ [Apartment(ApartmentState.STA)]
+ public void GivenViewWithStructuresData_WhenStructuresUpdatedAndNotified_ThenMapDataUpdated()
+ {
+ // Given
+ var failureMechanism = new ClosingStructuresFailureMechanism();
+ failureMechanism.ClosingStructures.AddRange(new[]
+ {
+ new TestClosingStructure(new Point2D(0, 0), "Id1")
+ }, "path");
+
+ ClosingStructuresFailureMechanismView view = CreateView(failureMechanism, new AssessmentSectionStub());
+
+ IMapControl map = ((RiskeerMapControl) view.Controls[0]).MapControl;
+
+ var mocks = new MockRepository();
+ IObserver[] observers = AttachMapDataObservers(mocks, map.Data.Collection);
+ observers[structuresObserverIndex].Expect(obs => obs.UpdateObserver());
+ mocks.ReplayAll();
+
+ MapData structuresData = map.Data.Collection.ElementAt(structuresIndex);
+
+ // Precondition
+ MapDataTestHelper.AssertStructuresMapData(failureMechanism.ClosingStructures,
+ structuresData);
+
+ // When
+ failureMechanism.ClosingStructures.AddRange(new[]
+ {
+ new TestClosingStructure(new Point2D(1, 1), "Id2")
+ }, "some path");
+ failureMechanism.ClosingStructures.NotifyObservers();
+
+ // Then
+ MapDataTestHelper.AssertStructuresMapData(failureMechanism.ClosingStructures,
+ structuresData);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ [Apartment(ApartmentState.STA)]
+ public void GivenViewWithCalculationGroupData_WhenCalculationGroupUpdatedAndNotified_ThenMapDataUpdated()
+ {
+ // Given
+ var calculationA = new StructuresCalculation
+ {
+ InputParameters =
+ {
+ HydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, string.Empty, 1.3, 2.3),
+ Structure = new TestClosingStructure(new Point2D(1.2, 2.3))
+ }
+ };
+
+ var failureMechanism = new ClosingStructuresFailureMechanism();
+ failureMechanism.CalculationsGroup.Children.Add(calculationA);
+
+ ClosingStructuresFailureMechanismView view = CreateView(failureMechanism, new AssessmentSectionStub());
+
+ IMapControl map = ((RiskeerMapControl) view.Controls[0]).MapControl;
+
+ var mocks = new MockRepository();
+ IObserver[] observers = AttachMapDataObservers(mocks, map.Data.Collection);
+ observers[calculationObserverIndex].Expect(obs => obs.UpdateObserver());
+ mocks.ReplayAll();
+
+ var calculationMapData = (MapLineData) map.Data.Collection.ElementAt(calculationsIndex);
+
+ // Precondition
+ AssertCalculationsMapData(failureMechanism.Calculations.Cast>(),
+ calculationMapData);
+
+ // When
+ var calculationB = new StructuresCalculation
+ {
+ InputParameters =
+ {
+ HydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, string.Empty, 7.7, 12.6),
+ Structure = new TestClosingStructure(new Point2D(2.7, 2.0))
+ }
+ };
+
+ failureMechanism.CalculationsGroup.Children.Add(calculationB);
+ failureMechanism.CalculationsGroup.NotifyObservers();
+
+ // Then
+ AssertCalculationsMapData(failureMechanism.Calculations.Cast>(), calculationMapData);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ [Apartment(ApartmentState.STA)]
+ public void GivenViewWithCalculationInputData_WhenCalculationInputUpdatedAndNotified_ThenMapDataUpdated()
+ {
+ // Given
+ var calculationA = new StructuresCalculation
+ {
+ InputParameters =
+ {
+ HydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, string.Empty, 1.3, 2.3),
+ Structure = new TestClosingStructure(new Point2D(1.2, 2.3))
+ }
+ };
+ var failureMechanism = new ClosingStructuresFailureMechanism();
+ failureMechanism.CalculationsGroup.Children.Add(calculationA);
+
+ ClosingStructuresFailureMechanismView view = CreateView(failureMechanism, new AssessmentSectionStub());
+
+ IMapControl map = ((RiskeerMapControl) view.Controls[0]).MapControl;
+
+ var mocks = new MockRepository();
+ IObserver[] observers = AttachMapDataObservers(mocks, map.Data.Collection);
+ observers[calculationObserverIndex].Expect(obs => obs.UpdateObserver());
+ mocks.ReplayAll();
+
+ var calculationMapData = (MapLineData) map.Data.Collection.ElementAt(calculationsIndex);
+
+ // Precondition
+ AssertCalculationsMapData(failureMechanism.Calculations.Cast>(),
+ calculationMapData);
+
+ // When
+ calculationA.InputParameters.Structure = new TestClosingStructure(new Point2D(2.7, 2.0));
+ calculationA.InputParameters.NotifyObservers();
+
+ // Then
+ AssertCalculationsMapData(failureMechanism.Calculations.Cast>(), calculationMapData);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ [Apartment(ApartmentState.STA)]
+ public void NotifyObservers_DataUpdated_MapLayersSameOrder()
+ {
+ // Setup
+ const int updatedReferenceLineLayerIndex = referenceLineIndex + 4;
+ const int updatedHydraulicLocationsLayerIndex = hydraulicBoundaryLocationsIndex - 1;
+ const int updatedForeshoreProfilesLayerIndex = foreshoreProfilesIndex - 1;
+ const int updatedStructuresLayerIndex = structuresIndex - 1;
+ const int updatedCalculationsIndex = calculationsIndex - 1;
+
+ var assessmentSection = new AssessmentSectionStub();
+
+ ClosingStructuresFailureMechanismView view = CreateView(new ClosingStructuresFailureMechanism(), assessmentSection);
+ IMapControl map = ((RiskeerMapControl) view.Controls[0]).MapControl;
+
+ MapDataCollection mapData = map.Data;
+
+ var dataToMove = (MapLineData) map.Data.Collection.ElementAt(referenceLineIndex);
+ mapData.Remove(dataToMove);
+ mapData.Add(dataToMove);
+
+ List mapDataList = mapData.Collection.ToList();
+
+ // Precondition
+ var referenceLineData = (MapLineData) mapDataList[updatedReferenceLineLayerIndex];
+ Assert.AreEqual("Referentielijn", referenceLineData.Name);
+
+ var hydraulicLocationsData = (MapPointData) mapDataList[updatedHydraulicLocationsLayerIndex];
+ Assert.AreEqual("Hydraulische belastingen", hydraulicLocationsData.Name);
+
+ var foreshoreProfilesData = (MapLineData) mapDataList[updatedForeshoreProfilesLayerIndex];
+ Assert.AreEqual("Voorlandprofielen", foreshoreProfilesData.Name);
+
+ var structuresData = (MapPointData) mapDataList[updatedStructuresLayerIndex];
+ Assert.AreEqual("Kunstwerken", structuresData.Name);
+
+ var calculationsData = (MapLineData) mapDataList[updatedCalculationsIndex];
+ Assert.AreEqual("Berekeningen", calculationsData.Name);
+
+ var points = new List
+ {
+ new Point2D(2.0, 5.0),
+ new Point2D(4.0, 3.0)
+ };
+ var referenceLine = new ReferenceLine();
+ referenceLine.SetGeometry(points);
+ assessmentSection.ReferenceLine = referenceLine;
+
+ // Call
+ assessmentSection.NotifyObservers();
+
+ // Assert
+ var actualReferenceLineData = (MapLineData) mapDataList[updatedReferenceLineLayerIndex];
+ Assert.AreEqual("Referentielijn", actualReferenceLineData.Name);
+
+ var actualHydraulicLocationsData = (MapPointData) mapDataList[updatedHydraulicLocationsLayerIndex];
+ Assert.AreEqual("Hydraulische belastingen", actualHydraulicLocationsData.Name);
+
+ var actualForeshoreProfilesData = (MapLineData) mapDataList[updatedForeshoreProfilesLayerIndex];
+ Assert.AreEqual("Voorlandprofielen", actualForeshoreProfilesData.Name);
+
+ var actualStructuresData = (MapPointData) mapDataList[updatedStructuresLayerIndex];
+ Assert.AreEqual("Kunstwerken", actualStructuresData.Name);
+
+ var actualCalculationsData = (MapLineData) mapDataList[updatedCalculationsIndex];
+ Assert.AreEqual("Berekeningen", actualCalculationsData.Name);
+ }
+
+ private ClosingStructuresFailureMechanismView CreateView(ClosingStructuresFailureMechanism failureMechanism, IAssessmentSection assessmentSection)
+ {
+ var view = new ClosingStructuresFailureMechanismView(failureMechanism, assessmentSection);
+
+ testForm.Controls.Add(view);
+ testForm.Show();
+
+ return view;
+ }
+
+ private static void AssertCalculationsMapData(IEnumerable> calculations, MapData mapData)
+ {
+ Assert.IsInstanceOf(mapData);
+ var calculationsMapData = (MapLineData) mapData;
+ StructuresCalculation[] calculationsArray = calculations.ToArray();
+ MapFeature[] calculationsFeatures = calculationsMapData.Features.ToArray();
+ Assert.AreEqual(calculationsArray.Length, calculationsFeatures.Length);
+
+ for (var index = 0; index < calculationsArray.Length; index++)
+ {
+ MapGeometry[] geometries = calculationsFeatures[index].MapGeometries.ToArray();
+ Assert.AreEqual(1, geometries.Length);
+
+ StructuresCalculation calculation = calculationsArray[index];
+ CollectionAssert.AreEquivalent(new[]
+ {
+ calculation.InputParameters.Structure.Location,
+ calculation.InputParameters.HydraulicBoundaryLocation.Location
+ }, geometries[0].PointCollections.First());
+ }
+
+ Assert.AreEqual("Berekeningen", mapData.Name);
+ }
+
+ private static void AssertEmptyMapData(MapDataCollection mapDataCollection)
+ {
+ Assert.AreEqual("Betrouwbaarheid sluiting kunstwerk", mapDataCollection.Name);
+
+ List mapDataList = mapDataCollection.Collection.ToList();
+
+ Assert.AreEqual(5, mapDataList.Count);
+
+ var referenceLineMapData = (MapLineData) mapDataList[referenceLineIndex];
+ var foreshoreProfilesMapData = (MapLineData) mapDataList[foreshoreProfilesIndex];
+ var structuresMapData = (MapPointData) mapDataList[structuresIndex];
+ var hydraulicBoundaryLocationsMapData = (MapPointData) mapDataList[hydraulicBoundaryLocationsIndex];
+ var calculationsMapData = (MapLineData) mapDataList[calculationsIndex];
+
+ CollectionAssert.IsEmpty(referenceLineMapData.Features);
+ CollectionAssert.IsEmpty(foreshoreProfilesMapData.Features);
+ CollectionAssert.IsEmpty(structuresMapData.Features);
+ CollectionAssert.IsEmpty(hydraulicBoundaryLocationsMapData.Features);
+ CollectionAssert.IsEmpty(calculationsMapData.Features);
+
+ Assert.AreEqual("Referentielijn", referenceLineMapData.Name);
+ Assert.AreEqual("Voorlandprofielen", foreshoreProfilesMapData.Name);
+ Assert.AreEqual("Kunstwerken", structuresMapData.Name);
+ Assert.AreEqual("Hydraulische belastingen", hydraulicBoundaryLocationsMapData.Name);
+ Assert.AreEqual("Berekeningen", calculationsMapData.Name);
+ }
+
+ ///
+ /// Attaches mocked observers to all map data components.
+ ///
+ /// The .
+ /// The map data collection containing the
+ /// elements.
+ /// An array of mocked observers attached to the data in .
+ private static IObserver[] AttachMapDataObservers(MockRepository mocks, IEnumerable mapData)
+ {
+ MapData[] mapDataArray = mapData.ToArray();
+
+ var referenceLineMapDataObserver = mocks.StrictMock();
+ mapDataArray[referenceLineIndex].Attach(referenceLineMapDataObserver);
+
+ var foreshoreProfilesMapDataObserver = mocks.StrictMock();
+ mapDataArray[foreshoreProfilesIndex].Attach(foreshoreProfilesMapDataObserver);
+
+ var structuresMapDataObserver = mocks.StrictMock();
+ mapDataArray[structuresIndex].Attach(structuresMapDataObserver);
+
+ var calculationsMapDataObserver = mocks.StrictMock();
+ mapDataArray[calculationsIndex].Attach(calculationsMapDataObserver);
+
+ return new[]
+ {
+ referenceLineMapDataObserver,
+ foreshoreProfilesMapDataObserver,
+ structuresMapDataObserver,
+ calculationsMapDataObserver
+ };
+ }
+ }
+}
\ No newline at end of file
Index: Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Forms.Test/Views/RegistrationState/ClosingStructuresFailureMechanismViewTest.cs
===================================================================
diff -u -rc92013504a173b7289b48e3f3163bac19417b531 -r28bcfbdfd620734930c60df8d0963b3b4b58fa7a
--- Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Forms.Test/Views/RegistrationState/ClosingStructuresFailureMechanismViewTest.cs (.../ClosingStructuresFailureMechanismViewTest.cs) (revision c92013504a173b7289b48e3f3163bac19417b531)
+++ Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Forms.Test/Views/RegistrationState/ClosingStructuresFailureMechanismViewTest.cs (.../ClosingStructuresFailureMechanismViewTest.cs) (revision 28bcfbdfd620734930c60df8d0963b3b4b58fa7a)
@@ -44,7 +44,7 @@
using Riskeer.Common.Data.TestUtil;
using Riskeer.Common.Forms.TestUtil;
using Riskeer.Common.Forms.Views;
-using CalculationStateFailureMechanismView = Riskeer.ClosingStructures.Forms.Views.CalculationState.ClosingStructuresFailureMechanismView;
+using CalculationsStateFailureMechanismView = Riskeer.ClosingStructures.Forms.Views.CalculationsState.ClosingStructuresFailureMechanismView;
namespace Riskeer.ClosingStructures.Forms.Test.Views.RegistrationState
{
@@ -93,7 +93,7 @@
ClosingStructuresFailureMechanismView view = CreateView(failureMechanism, assessmentSection);
// Assert
- Assert.IsInstanceOf(view);
+ Assert.IsInstanceOf(view);
Assert.IsNull(view.Data);
Assert.AreSame(failureMechanism, view.FailureMechanism);
Assert.AreSame(assessmentSection, view.AssessmentSection);
Index: Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Plugin.Test/ClosingStructuresPluginTest.cs
===================================================================
diff -u -r436a226ddd1cd4d55203bd8239ce8a63ae0e7889 -r28bcfbdfd620734930c60df8d0963b3b4b58fa7a
--- Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Plugin.Test/ClosingStructuresPluginTest.cs (.../ClosingStructuresPluginTest.cs) (revision 436a226ddd1cd4d55203bd8239ce8a63ae0e7889)
+++ Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Plugin.Test/ClosingStructuresPluginTest.cs (.../ClosingStructuresPluginTest.cs) (revision 28bcfbdfd620734930c60df8d0963b3b4b58fa7a)
@@ -38,11 +38,11 @@
using Riskeer.Common.Data.FailureMechanism;
using Riskeer.Common.Forms.PropertyClasses;
using Riskeer.Common.Forms.Views;
-using CalculationStateFailureMechanismContext = Riskeer.ClosingStructures.Forms.PresentationObjects.CalculationState.ClosingStructuresFailureMechanismContext;
+using CalculationsStateFailureMechanismContext = Riskeer.ClosingStructures.Forms.PresentationObjects.CalculationsState.ClosingStructuresFailureMechanismContext;
using RegistrationStateFailureMechanismContext = Riskeer.ClosingStructures.Forms.PresentationObjects.RegistrationState.ClosingStructuresFailureMechanismContext;
-using CalculationStateFailureMechanismProperties = Riskeer.ClosingStructures.Forms.PropertyClasses.CalculationState.ClosingStructuresFailureMechanismProperties;
+using CalculationsStateFailureMechanismProperties = Riskeer.ClosingStructures.Forms.PropertyClasses.CalculationsState.ClosingStructuresFailureMechanismProperties;
using RegistrationStateFailureMechanismProperties = Riskeer.ClosingStructures.Forms.PropertyClasses.RegistrationState.ClosingStructuresFailureMechanismProperties;
-using CalculationStateFailureMechanismView = Riskeer.ClosingStructures.Forms.Views.CalculationState.ClosingStructuresFailureMechanismView;
+using CalculationsStateFailureMechanismView = Riskeer.ClosingStructures.Forms.Views.CalculationsState.ClosingStructuresFailureMechanismView;
using RegistrationStateFailureMechanismView = Riskeer.ClosingStructures.Forms.Views.RegistrationState.ClosingStructuresFailureMechanismView;
namespace Riskeer.ClosingStructures.Plugin.Test
@@ -75,8 +75,8 @@
PluginTestHelper.AssertPropertyInfoDefined(
propertyInfos,
- typeof(CalculationStateFailureMechanismContext),
- typeof(CalculationStateFailureMechanismProperties));
+ typeof(CalculationsStateFailureMechanismContext),
+ typeof(CalculationsStateFailureMechanismProperties));
PluginTestHelper.AssertPropertyInfoDefined(
propertyInfos,
@@ -111,7 +111,7 @@
// Assert
Assert.AreEqual(9, treeNodeInfos.Length);
- Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(CalculationStateFailureMechanismContext)));
+ Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(CalculationsStateFailureMechanismContext)));
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(RegistrationStateFailureMechanismContext)));
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(ClosingStructuresFailureMechanismSectionResultContext)));
Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(ClosingStructuresContext)));
@@ -148,8 +148,8 @@
PluginTestHelper.AssertViewInfoDefined(
viewInfos,
- typeof(CalculationStateFailureMechanismContext),
- typeof(CalculationStateFailureMechanismView));
+ typeof(CalculationsStateFailureMechanismContext),
+ typeof(CalculationsStateFailureMechanismView));
PluginTestHelper.AssertViewInfoDefined(
viewInfos,
Fisheye: Tag 28bcfbdfd620734930c60df8d0963b3b4b58fa7a refers to a dead (removed) revision in file `Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Plugin.Test/PropertyInfos/CalculationState/ClosingStructuresFailureMechanismPropertyInfoTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Plugin.Test/PropertyInfos/CalculationsState/ClosingStructuresFailureMechanismPropertyInfoTest.cs
===================================================================
diff -u
--- Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Plugin.Test/PropertyInfos/CalculationsState/ClosingStructuresFailureMechanismPropertyInfoTest.cs (revision 0)
+++ Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Plugin.Test/PropertyInfos/CalculationsState/ClosingStructuresFailureMechanismPropertyInfoTest.cs (revision 28bcfbdfd620734930c60df8d0963b3b4b58fa7a)
@@ -0,0 +1,82 @@
+// Copyright (C) Stichting Deltares 2021. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer 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.Linq;
+using Core.Gui.Plugin;
+using Core.Gui.PropertyBag;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Riskeer.ClosingStructures.Data;
+using Riskeer.ClosingStructures.Forms.PresentationObjects.CalculationsState;
+using Riskeer.ClosingStructures.Forms.PropertyClasses.CalculationsState;
+using Riskeer.Common.Data.AssessmentSection;
+
+namespace Riskeer.ClosingStructures.Plugin.Test.PropertyInfos.CalculationsState
+{
+ [TestFixture]
+ public class ClosingStructuresFailureMechanismPropertyInfoTest
+ {
+ private ClosingStructuresPlugin plugin;
+ private PropertyInfo info;
+
+ [SetUp]
+ public void SetUp()
+ {
+ plugin = new ClosingStructuresPlugin();
+ info = plugin.GetPropertyInfos().First(tni => tni.PropertyObjectType == typeof(ClosingStructuresFailureMechanismProperties));
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ plugin.Dispose();
+ }
+
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Assert
+ Assert.AreEqual(typeof(ClosingStructuresFailureMechanismContext), info.DataType);
+ Assert.AreEqual(typeof(ClosingStructuresFailureMechanismProperties), info.PropertyObjectType);
+ }
+
+ [Test]
+ public void CreateInstance_WithContext_NewPropertiesWithFailureMechanismAsData()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new ClosingStructuresFailureMechanism();
+ var context = new ClosingStructuresFailureMechanismContext(failureMechanism, assessmentSection);
+
+ // Call
+ IObjectProperties objectProperties = info.CreateInstance(context);
+
+ // Assert
+ Assert.IsInstanceOf(objectProperties);
+ Assert.AreSame(failureMechanism, objectProperties.Data);
+
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 28bcfbdfd620734930c60df8d0963b3b4b58fa7a refers to a dead (removed) revision in file `Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Plugin.Test/TreeNodeInfos/CalculationState/ClosingStructuresFailureMechanismContextTreeNodeInfoTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Plugin.Test/TreeNodeInfos/CalculationsState/ClosingStructuresFailureMechanismContextTreeNodeInfoTest.cs
===================================================================
diff -u
--- Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Plugin.Test/TreeNodeInfos/CalculationsState/ClosingStructuresFailureMechanismContextTreeNodeInfoTest.cs (revision 0)
+++ Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Plugin.Test/TreeNodeInfos/CalculationsState/ClosingStructuresFailureMechanismContextTreeNodeInfoTest.cs (revision 28bcfbdfd620734930c60df8d0963b3b4b58fa7a)
@@ -0,0 +1,802 @@
+// Copyright (C) Stichting Deltares 2021. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer 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.Drawing;
+using System.IO;
+using System.Linq;
+using System.Windows.Forms;
+using Core.Common.Base;
+using Core.Common.Controls.TreeView;
+using Core.Common.TestUtil;
+using Core.Gui;
+using Core.Gui.ContextMenu;
+using Core.Gui.Forms.Main;
+using Core.Gui.TestUtil;
+using Core.Gui.TestUtil.ContextMenu;
+using NUnit.Extensions.Forms;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Riskeer.ClosingStructures.Data;
+using Riskeer.ClosingStructures.Data.TestUtil;
+using Riskeer.ClosingStructures.Forms.PresentationObjects;
+using Riskeer.ClosingStructures.Forms.PresentationObjects.CalculationsState;
+using Riskeer.Common.Data;
+using Riskeer.Common.Data.AssessmentSection;
+using Riskeer.Common.Data.Hydraulics;
+using Riskeer.Common.Data.Structures;
+using Riskeer.Common.Data.TestUtil;
+using Riskeer.Common.Data.TestUtil.IllustrationPoints;
+using Riskeer.Common.Forms.PresentationObjects;
+using Riskeer.Common.Service.TestUtil;
+using Riskeer.HydraRing.Calculation.Calculator.Factory;
+using Riskeer.HydraRing.Calculation.Data.Input;
+using Riskeer.HydraRing.Calculation.Data.Input.Structures;
+using Riskeer.HydraRing.Calculation.TestUtil.Calculator;
+using RiskeerCommonFormsResources = Riskeer.Common.Forms.Properties.Resources;
+
+namespace Riskeer.ClosingStructures.Plugin.Test.TreeNodeInfos.CalculationsState
+{
+ [TestFixture]
+ public class ClosingStructuresFailureMechanismContextTreeNodeInfoTest : NUnitFormTest
+ {
+ private const int contextMenuValidateAllIndex = 2;
+ private const int contextMenuCalculateAllIndex = 3;
+ private const int contextMenuClearAllIndex = 5;
+ private const int contextMenuClearIllustrationPointsIndex = 6;
+
+ private readonly string testDataPath = TestHelper.GetTestDataPath(TestDataPath.Riskeer.Common.IO, nameof(HydraulicBoundaryDatabase));
+
+ private MockRepository mocksRepository;
+ private ClosingStructuresPlugin plugin;
+ private TreeNodeInfo info;
+
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Setup
+ mocksRepository.ReplayAll();
+
+ // Assert
+ Assert.IsNotNull(info.Text);
+ Assert.IsNotNull(info.ForeColor);
+ Assert.IsNotNull(info.Image);
+ Assert.IsNotNull(info.ContextMenuStrip);
+ Assert.IsNull(info.EnsureVisibleOnCreate);
+ Assert.IsNull(info.ExpandOnCreate);
+ Assert.IsNotNull(info.ChildNodeObjects);
+ Assert.IsNull(info.CanRename);
+ Assert.IsNull(info.OnNodeRenamed);
+ Assert.IsNull(info.CanRemove);
+ Assert.IsNull(info.OnNodeRemoved);
+ Assert.IsNull(info.CanCheck);
+ Assert.IsNull(info.CheckedState);
+ Assert.IsNull(info.OnNodeChecked);
+ Assert.IsNull(info.CanDrag);
+ Assert.IsNull(info.CanDrop);
+ Assert.IsNull(info.CanInsert);
+ Assert.IsNull(info.OnDrop);
+ }
+
+ [Test]
+ public void Text_WithContext_ReturnsName()
+ {
+ // Setup
+ var assessmentSection = mocksRepository.Stub();
+ mocksRepository.ReplayAll();
+
+ var failureMechanism = new ClosingStructuresFailureMechanism();
+ var context = new ClosingStructuresFailureMechanismContext(failureMechanism, assessmentSection);
+
+ // Call
+ string text = info.Text(context);
+
+ // Assert
+ Assert.AreEqual(failureMechanism.Name, text);
+ }
+
+ [Test]
+ public void Image_Always_ReturnsFailureMechanismIcon()
+ {
+ // Setup
+ mocksRepository.ReplayAll();
+
+ // Call
+ Image image = info.Image(null);
+
+ // Assert
+ TestHelper.AssertImagesAreEqual(RiskeerCommonFormsResources.FailureMechanismIcon, image);
+ }
+
+ [Test]
+ public void ChildNodeObjects_WithContext_ReturnChildDataNodes()
+ {
+ // Setup
+ var assessmentSection = new AssessmentSectionStub();
+ var failureMechanism = new ClosingStructuresFailureMechanism();
+ var context = new ClosingStructuresFailureMechanismContext(failureMechanism, assessmentSection);
+
+ // Call
+ object[] children = info.ChildNodeObjects(context).ToArray();
+
+ // Assert
+ Assert.AreEqual(2, children.Length);
+
+ var inputsFolder = (CategoryTreeFolder) children[0];
+ Assert.AreEqual("Invoer", inputsFolder.Name);
+ Assert.AreEqual(TreeFolderCategory.Input, inputsFolder.Category);
+
+ Assert.AreEqual(3, inputsFolder.Contents.Count());
+ var profilesContext = (ForeshoreProfilesContext) inputsFolder.Contents.ElementAt(0);
+ Assert.AreSame(failureMechanism.ForeshoreProfiles, profilesContext.WrappedData);
+ Assert.AreSame(failureMechanism, profilesContext.ParentFailureMechanism);
+ Assert.AreSame(assessmentSection, profilesContext.ParentAssessmentSection);
+
+ var closingStructuresContext = (ClosingStructuresContext) inputsFolder.Contents.ElementAt(1);
+ Assert.AreSame(failureMechanism.ClosingStructures, closingStructuresContext.WrappedData);
+ Assert.AreSame(failureMechanism, closingStructuresContext.FailureMechanism);
+ Assert.AreSame(assessmentSection, closingStructuresContext.AssessmentSection);
+
+ var calculationsInputComments = (Comment) inputsFolder.Contents.ElementAt(2);
+ Assert.AreSame(failureMechanism.CalculationsInputComments, calculationsInputComments);
+
+ var calculationsFolder = (ClosingStructuresCalculationGroupContext) children[1];
+ Assert.AreEqual(failureMechanism.CalculationsGroup, calculationsFolder.WrappedData);
+ Assert.IsNull(calculationsFolder.Parent);
+ Assert.AreEqual(failureMechanism, calculationsFolder.FailureMechanism);
+ }
+
+ [Test]
+ public void ContextMenuStrip_WithContext_CallsContextMenuBuilderMethods()
+ {
+ // Setup
+ var failureMechanism = new ClosingStructuresFailureMechanism();
+ var assessmentSection = mocksRepository.Stub();
+ var context = new ClosingStructuresFailureMechanismContext(failureMechanism, assessmentSection);
+
+ var menuBuilder = mocksRepository.StrictMock();
+ using (mocksRepository.Ordered())
+ {
+ menuBuilder.Expect(mb => mb.AddOpenItem()).Return(menuBuilder);
+ menuBuilder.Expect(mb => mb.AddSeparator()).Return(menuBuilder);
+ menuBuilder.Expect(mb => mb.AddCustomItem(null)).IgnoreArguments().Return(menuBuilder);
+ menuBuilder.Expect(mb => mb.AddCustomItem(null)).IgnoreArguments().Return(menuBuilder);
+ menuBuilder.Expect(mb => mb.AddSeparator()).Return(menuBuilder);
+ menuBuilder.Expect(mb => mb.AddCustomItem(null)).IgnoreArguments().Return(menuBuilder);
+ menuBuilder.Expect(mb => mb.AddCustomItem(null)).IgnoreArguments().Return(menuBuilder);
+ menuBuilder.Expect(mb => mb.AddSeparator()).Return(menuBuilder);
+ menuBuilder.Expect(mb => mb.AddCollapseAllItem()).Return(menuBuilder);
+ menuBuilder.Expect(mb => mb.AddExpandAllItem()).Return(menuBuilder);
+ menuBuilder.Expect(mb => mb.AddSeparator()).Return(menuBuilder);
+ menuBuilder.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilder);
+ menuBuilder.Expect(mb => mb.Build()).Return(null);
+ }
+
+ using (var treeViewControl = new TreeViewControl())
+ {
+ var gui = mocksRepository.Stub();
+ gui.Stub(cmp => cmp.Get(context, treeViewControl)).Return(menuBuilder);
+ gui.Stub(g => g.MainWindow).Return(mocksRepository.Stub());
+ mocksRepository.ReplayAll();
+
+ plugin.Gui = gui;
+
+ // Call
+ info.ContextMenuStrip(context, null, treeViewControl);
+ }
+
+ // Assert
+ // Assert is done in TearDown
+ }
+
+ [Test]
+ public void ContextMenuStrip_WithContext_AddCustomItems()
+ {
+ // Setup
+ using (var treeView = new TreeViewControl())
+ {
+ var assessmentSection = mocksRepository.Stub();
+ var failureMechanism = new ClosingStructuresFailureMechanism();
+ var context = new ClosingStructuresFailureMechanismContext(failureMechanism, assessmentSection);
+ var menuBuilder = new CustomItemsOnlyContextMenuBuilder();
+
+ var gui = mocksRepository.Stub();
+ gui.Stub(cmp => cmp.Get(context, treeView)).Return(menuBuilder);
+ gui.Stub(g => g.ProjectOpened += null).IgnoreArguments();
+ gui.Stub(g => g.ProjectOpened -= null).IgnoreArguments();
+ gui.Stub(g => g.MainWindow).Return(mocksRepository.Stub());
+ mocksRepository.ReplayAll();
+
+ plugin.Gui = gui;
+
+ // Call
+ using (ContextMenuStrip menu = info.ContextMenuStrip(context, assessmentSection, treeView))
+ {
+ // Assert
+ Assert.AreEqual(12, menu.Items.Count);
+
+ TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuValidateAllIndex,
+ "Alles &valideren",
+ "Er zijn geen berekeningen om te valideren.",
+ RiskeerCommonFormsResources.ValidateAllIcon,
+ false);
+ TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuCalculateAllIndex,
+ "Alles be&rekenen",
+ "Er zijn geen berekeningen om uit te voeren.",
+ RiskeerCommonFormsResources.CalculateAllIcon,
+ false);
+
+ TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuClearAllIndex,
+ "&Wis alle uitvoer...",
+ "Er zijn geen berekeningen met uitvoer om te wissen.",
+ RiskeerCommonFormsResources.ClearIcon,
+ false);
+ TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuClearIllustrationPointsIndex,
+ "Wis alle illustratiepunten...",
+ "Er zijn geen berekeningen met illustratiepunten om te wissen.",
+ RiskeerCommonFormsResources.ClearIllustrationPointsIcon,
+ false);
+ }
+ }
+ }
+
+ [Test]
+ public void ContextMenuStrip_HydraulicBoundaryDatabaseNotLinked_ContextMenuItemCalculateAllAndValidateAllDisabledAndTooltipSet()
+ {
+ // Setup
+ var failureMechanism = new ClosingStructuresFailureMechanism();
+ failureMechanism.CalculationsGroup.Children.Add(new StructuresCalculation());
+
+ IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(mocksRepository);
+
+ var nodeData = new ClosingStructuresFailureMechanismContext(failureMechanism, assessmentSection);
+ var menuBuilder = new CustomItemsOnlyContextMenuBuilder();
+
+ using (var treeViewControl = new TreeViewControl())
+ {
+ var gui = mocksRepository.Stub();
+ gui.Stub(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder);
+ gui.Stub(g => g.MainWindow).Return(mocksRepository.Stub());
+ mocksRepository.ReplayAll();
+
+ plugin.Gui = gui;
+
+ // Call
+ using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl))
+ {
+ // Assert
+ TestHelper.AssertContextMenuStripContainsItem(contextMenu, contextMenuCalculateAllIndex,
+ "Alles be&rekenen",
+ "Er is geen hydraulische belastingendatabase geïmporteerd.",
+ RiskeerCommonFormsResources.CalculateAllIcon,
+ false);
+
+ TestHelper.AssertContextMenuStripContainsItem(contextMenu, contextMenuValidateAllIndex,
+ "Alles &valideren",
+ "Er is geen hydraulische belastingendatabase geïmporteerd.",
+ RiskeerCommonFormsResources.ValidateAllIcon,
+ false);
+ }
+ }
+ }
+
+ [Test]
+ public void ContextMenuStrip_HydraulicBoundaryDatabaseLinkedToInvalidFile_ContextMenuItemCalculateAllAndValidateAllDisabledAndTooltipSet()
+ {
+ // Setup
+ var failureMechanism = new ClosingStructuresFailureMechanism();
+ failureMechanism.CalculationsGroup.Children.Add(new StructuresCalculation());
+
+ IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(null, mocksRepository, "invalidFilePath");
+
+ var nodeData = new ClosingStructuresFailureMechanismContext(failureMechanism, assessmentSection);
+ var menuBuilder = new CustomItemsOnlyContextMenuBuilder();
+
+ using (var treeViewControl = new TreeViewControl())
+ {
+ var gui = mocksRepository.Stub();
+ gui.Stub(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder);
+ gui.Stub(g => g.MainWindow).Return(mocksRepository.Stub());
+ mocksRepository.ReplayAll();
+
+ plugin.Gui = gui;
+
+ // Call
+ using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl))
+ {
+ // Assert
+ ToolStripItem calculateAllContextMenuItem = contextMenu.Items[contextMenuCalculateAllIndex];
+
+ Assert.AreEqual("Alles be&rekenen", calculateAllContextMenuItem.Text);
+ StringAssert.Contains("Herstellen van de verbinding met de hydraulische belastingendatabase is mislukt. ", calculateAllContextMenuItem.ToolTipText);
+ TestHelper.AssertImagesAreEqual(RiskeerCommonFormsResources.CalculateAllIcon, calculateAllContextMenuItem.Image);
+ Assert.IsFalse(calculateAllContextMenuItem.Enabled);
+
+ ToolStripItem validateAllContextMenuItem = contextMenu.Items[contextMenuValidateAllIndex];
+
+ Assert.AreEqual("Alles &valideren", validateAllContextMenuItem.Text);
+ StringAssert.Contains("Herstellen van de verbinding met de hydraulische belastingendatabase is mislukt. ", validateAllContextMenuItem.ToolTipText);
+ TestHelper.AssertImagesAreEqual(RiskeerCommonFormsResources.ValidateAllIcon, validateAllContextMenuItem.Image);
+ Assert.IsFalse(validateAllContextMenuItem.Enabled);
+ }
+ }
+ }
+
+ [Test]
+ public void ContextMenuStrip_AllRequiredInputSet_ContextMenuItemCalculateAllAndValidateAllEnabled()
+ {
+ // Setup
+ var failureMechanism = new ClosingStructuresFailureMechanism();
+ failureMechanism.CalculationsGroup.Children.Add(new StructuresCalculation());
+
+ string validFilePath = Path.Combine(testDataPath, "complete.sqlite");
+
+ var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase
+ {
+ FilePath = validFilePath,
+ Version = "1.0"
+ };
+ HydraulicBoundaryDatabaseTestHelper.SetHydraulicBoundaryLocationConfigurationSettings(hydraulicBoundaryDatabase);
+
+ var assessmentSection = mocksRepository.Stub();
+ assessmentSection.Stub(a => a.HydraulicBoundaryDatabase).Return(hydraulicBoundaryDatabase);
+
+ var nodeData = new ClosingStructuresFailureMechanismContext(failureMechanism, assessmentSection);
+ var menuBuilder = new CustomItemsOnlyContextMenuBuilder();
+
+ using (var treeViewControl = new TreeViewControl())
+ {
+ var gui = mocksRepository.Stub();
+ gui.Stub(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder);
+ gui.Stub(g => g.MainWindow).Return(mocksRepository.Stub());
+ mocksRepository.ReplayAll();
+
+ plugin.Gui = gui;
+
+ // Call
+ using (ContextMenuStrip menu = info.ContextMenuStrip(nodeData, null, treeViewControl))
+ {
+ // Assert
+ TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuCalculateAllIndex,
+ "Alles be&rekenen",
+ "Voer alle berekeningen binnen dit faalmechanisme uit.",
+ RiskeerCommonFormsResources.CalculateAllIcon);
+
+ TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuValidateAllIndex,
+ "Alles &valideren",
+ "Valideer alle berekeningen binnen dit faalmechanisme.",
+ RiskeerCommonFormsResources.ValidateAllIcon);
+ }
+ }
+ }
+
+ [Test]
+ public void ContextMenuStrip_ClickOnCalculateAllItem_ScheduleAllChildCalculations()
+ {
+ // Setup
+ IMainWindow mainWindow = MainWindowTestHelper.CreateMainWindowStub(mocksRepository);
+ var menuBuilder = new CustomItemsOnlyContextMenuBuilder();
+
+ var failureMechanism = new ClosingStructuresFailureMechanism();
+ failureMechanism.CalculationsGroup.Children.Add(new TestClosingStructuresCalculationScenario
+ {
+ Name = "A",
+ InputParameters =
+ {
+ HydraulicBoundaryLocation = new TestHydraulicBoundaryLocation()
+ }
+ });
+ failureMechanism.CalculationsGroup.Children.Add(new TestClosingStructuresCalculationScenario
+ {
+ Name = "B",
+ InputParameters =
+ {
+ HydraulicBoundaryLocation = new TestHydraulicBoundaryLocation()
+ }
+ });
+
+ var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase
+ {
+ FilePath = Path.Combine(testDataPath, "complete.sqlite")
+ };
+ HydraulicBoundaryDatabaseTestHelper.SetHydraulicBoundaryLocationConfigurationSettings(hydraulicBoundaryDatabase);
+
+ var assessmentSection = mocksRepository.Stub();
+ assessmentSection.Stub(a => a.Id).Return(string.Empty);
+ assessmentSection.Stub(a => a.FailureMechanismContribution).Return(FailureMechanismContributionTestFactory.CreateFailureMechanismContribution());
+ assessmentSection.Stub(a => a.HydraulicBoundaryDatabase).Return(hydraulicBoundaryDatabase);
+
+ var context = new ClosingStructuresFailureMechanismContext(failureMechanism, assessmentSection);
+
+ using (var treeViewControl = new TreeViewControl())
+ {
+ var gui = mocksRepository.Stub();
+ gui.Stub(g => g.Get(context, treeViewControl)).Return(menuBuilder);
+ gui.Stub(g => g.MainWindow).Return(mainWindow);
+
+ int nrOfCalculators = failureMechanism.Calculations.Count();
+ var calculatorFactory = mocksRepository.Stub();
+ calculatorFactory.Expect(cf => cf.CreateStructuresCalculator(
+ Arg.Is.NotNull))
+ .WhenCalled(invocation =>
+ {
+ HydraRingCalculationSettingsTestHelper.AssertHydraRingCalculationSettings(
+ HydraulicBoundaryCalculationSettingsFactory.CreateSettings(hydraulicBoundaryDatabase),
+ (HydraRingCalculationSettings) invocation.Arguments[0]);
+ })
+ .Return(new TestStructuresCalculator())
+ .Repeat
+ .Times(nrOfCalculators);
+ mocksRepository.ReplayAll();
+
+ plugin.Gui = gui;
+
+ DialogBoxHandler = (name, wnd) =>
+ {
+ // Expect an activity dialog which is automatically closed
+ };
+
+ using (ContextMenuStrip contextMenu = info.ContextMenuStrip(context, null, treeViewControl))
+ using (new HydraRingCalculatorFactoryConfig(calculatorFactory))
+ {
+ // Call
+ TestHelper.AssertLogMessages(() => contextMenu.Items[contextMenuCalculateAllIndex].PerformClick(), messages =>
+ {
+ List messageList = messages.ToList();
+
+ // Assert
+ Assert.AreEqual(14, messageList.Count);
+ Assert.AreEqual("Uitvoeren van berekening 'A' is gestart.", messageList[0]);
+ CalculationServiceTestHelper.AssertValidationStartMessage(messageList[1]);
+ CalculationServiceTestHelper.AssertValidationEndMessage(messageList[2]);
+ CalculationServiceTestHelper.AssertCalculationStartMessage(messageList[3]);
+ StringAssert.StartsWith("Betrouwbaarheid sluiting kunstwerk berekening is uitgevoerd op de tijdelijke locatie", messageList[4]);
+ CalculationServiceTestHelper.AssertCalculationEndMessage(messageList[5]);
+ Assert.AreEqual("Uitvoeren van berekening 'A' is gelukt.", messageList[6]);
+
+ Assert.AreEqual("Uitvoeren van berekening 'B' is gestart.", messageList[7]);
+ CalculationServiceTestHelper.AssertValidationStartMessage(messageList[8]);
+ CalculationServiceTestHelper.AssertValidationEndMessage(messageList[9]);
+ CalculationServiceTestHelper.AssertCalculationStartMessage(messageList[10]);
+ StringAssert.StartsWith("Betrouwbaarheid sluiting kunstwerk berekening is uitgevoerd op de tijdelijke locatie", messageList[11]);
+ CalculationServiceTestHelper.AssertCalculationEndMessage(messageList[12]);
+ Assert.AreEqual("Uitvoeren van berekening 'B' is gelukt.", messageList[13]);
+ });
+ }
+ }
+ }
+
+ [Test]
+ public void ContextMenuStrip_ClickOnValidateAllItem_ValidateAllChildCalculations()
+ {
+ // Setup
+ var failureMechanism = new ClosingStructuresFailureMechanism();
+ failureMechanism.CalculationsGroup.Children.Add(new TestClosingStructuresCalculationScenario
+ {
+ Name = "A",
+ InputParameters =
+ {
+ HydraulicBoundaryLocation = new TestHydraulicBoundaryLocation()
+ }
+ });
+ failureMechanism.CalculationsGroup.Children.Add(new TestClosingStructuresCalculationScenario
+ {
+ Name = "B",
+ InputParameters =
+ {
+ HydraulicBoundaryLocation = new TestHydraulicBoundaryLocation()
+ }
+ });
+
+ string validFilePath = Path.Combine(testDataPath, "complete.sqlite");
+
+ var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase
+ {
+ FilePath = validFilePath
+ };
+ HydraulicBoundaryDatabaseTestHelper.SetHydraulicBoundaryLocationConfigurationSettings(hydraulicBoundaryDatabase);
+
+ var assessmentSection = mocksRepository.Stub();
+ assessmentSection.Stub(a => a.HydraulicBoundaryDatabase).Return(hydraulicBoundaryDatabase);
+
+ var context = new ClosingStructuresFailureMechanismContext(failureMechanism, assessmentSection);
+
+ using (var treeViewControl = new TreeViewControl())
+ {
+ var menuBuilder = new CustomItemsOnlyContextMenuBuilder();
+ var gui = mocksRepository.Stub();
+ gui.Stub(g => g.Get(context, treeViewControl)).Return(menuBuilder);
+ gui.Stub(g => g.MainWindow).Return(mocksRepository.Stub());
+ mocksRepository.ReplayAll();
+
+ plugin.Gui = gui;
+
+ using (ContextMenuStrip contextMenu = info.ContextMenuStrip(context, null, treeViewControl))
+ {
+ // Call
+ void Call() => contextMenu.Items[contextMenuValidateAllIndex].PerformClick();
+
+ // Assert
+ TestHelper.AssertLogMessages(Call, messages =>
+ {
+ string[] messageList = messages.ToArray();
+
+ Assert.AreEqual(4, messageList.Length);
+ CalculationServiceTestHelper.AssertValidationStartMessage(messageList[0]);
+ CalculationServiceTestHelper.AssertValidationEndMessage(messageList[1]);
+ CalculationServiceTestHelper.AssertValidationStartMessage(messageList[2]);
+ CalculationServiceTestHelper.AssertValidationEndMessage(messageList[3]);
+ });
+ }
+ }
+ }
+
+ [Test]
+ public void ContextMenuStrip_FailureMechanismWithCalculationsContainingIllustrationPoints_ContextMenuItemClearIllustrationPointsEnabled()
+ {
+ // Setup
+ var calculationWithIllustrationPoints = new TestClosingStructuresCalculationScenario
+ {
+ Output = new TestStructuresOutput(new TestGeneralResultFaultTreeIllustrationPoint())
+ };
+
+ var calculationWithOutput = new TestClosingStructuresCalculationScenario
+ {
+ Output = new TestStructuresOutput()
+ };
+
+ var failureMechanism = new ClosingStructuresFailureMechanism
+ {
+ CalculationsGroup =
+ {
+ Children =
+ {
+ calculationWithIllustrationPoints,
+ calculationWithOutput,
+ new TestClosingStructuresCalculationScenario()
+ }
+ }
+ };
+
+ IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(null, mocksRepository, "invalidFilePath");
+
+ var nodeData = new ClosingStructuresFailureMechanismContext(failureMechanism, assessmentSection);
+ var menuBuilder = new CustomItemsOnlyContextMenuBuilder();
+
+ using (var treeViewControl = new TreeViewControl())
+ {
+ var gui = mocksRepository.Stub();
+ gui.Stub(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder);
+ gui.Stub(g => g.MainWindow).Return(mocksRepository.Stub());
+ mocksRepository.ReplayAll();
+
+ plugin.Gui = gui;
+
+ using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl))
+ {
+ // Call
+ ToolStripItem toolStripItem = contextMenu.Items[contextMenuClearIllustrationPointsIndex];
+
+ // Assert
+ Assert.IsTrue(toolStripItem.Enabled);
+ }
+ }
+ }
+
+ [Test]
+ public void ContextMenuStrip_FailureMechanismWithCalculationsWithoutIllustrationPoints_ContextMenuItemClearIllustrationPointsDisabled()
+ {
+ // Setup
+ var calculationWithOutput = new TestClosingStructuresCalculationScenario
+ {
+ Output = new TestStructuresOutput()
+ };
+
+ var failureMechanism = new ClosingStructuresFailureMechanism
+ {
+ CalculationsGroup =
+ {
+ Children =
+ {
+ calculationWithOutput,
+ new TestClosingStructuresCalculationScenario()
+ }
+ }
+ };
+
+ IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(null, mocksRepository, "invalidFilePath");
+
+ var nodeData = new ClosingStructuresFailureMechanismContext(failureMechanism, assessmentSection);
+ var menuBuilder = new CustomItemsOnlyContextMenuBuilder();
+
+ using (var treeViewControl = new TreeViewControl())
+ {
+ var gui = mocksRepository.Stub();
+ gui.Stub(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder);
+ gui.Stub(g => g.MainWindow).Return(mocksRepository.Stub());
+ mocksRepository.ReplayAll();
+
+ plugin.Gui = gui;
+
+ using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl))
+ {
+ // Call
+ ToolStripItem toolStripItem = contextMenu.Items[contextMenuClearIllustrationPointsIndex];
+
+ // Assert
+ Assert.IsFalse(toolStripItem.Enabled);
+ }
+ }
+ }
+
+ [Test]
+ public void GivenCalculationsWithIllustrationPoints_WhenClearIllustrationPointsClickedAndAborted_ThenInquiryAndIllustrationPointsNotCleared()
+ {
+ // Given
+ var calculationWithIllustrationPoints = new TestClosingStructuresCalculationScenario
+ {
+ Output = new TestStructuresOutput(new TestGeneralResultFaultTreeIllustrationPoint())
+ };
+
+ var calculationWithOutput = new TestClosingStructuresCalculationScenario
+ {
+ Output = new TestStructuresOutput()
+ };
+
+ var failureMechanism = new ClosingStructuresFailureMechanism
+ {
+ CalculationsGroup =
+ {
+ Children =
+ {
+ calculationWithIllustrationPoints,
+ calculationWithOutput,
+ new TestClosingStructuresCalculationScenario()
+ }
+ }
+ };
+
+ var calculationObserver = mocksRepository.StrictMock();
+ calculationWithIllustrationPoints.Attach(calculationObserver);
+
+ IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(null, mocksRepository, "invalidFilePath");
+
+ var nodeData = new ClosingStructuresFailureMechanismContext(failureMechanism, assessmentSection);
+ var menuBuilder = new CustomItemsOnlyContextMenuBuilder();
+
+ var messageBoxText = "";
+ DialogBoxHandler = (name, wnd) =>
+ {
+ var helper = new MessageBoxTester(wnd);
+ messageBoxText = helper.Text;
+
+ helper.ClickCancel();
+ };
+
+ using (var treeViewControl = new TreeViewControl())
+ {
+ var gui = mocksRepository.Stub();
+ gui.Stub(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder);
+ gui.Stub(g => g.MainWindow).Return(mocksRepository.Stub());
+ mocksRepository.ReplayAll();
+
+ plugin.Gui = gui;
+
+ using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl))
+ {
+ // When
+ contextMenu.Items[contextMenuClearIllustrationPointsIndex].PerformClick();
+
+ // Then
+ Assert.AreEqual("Weet u zeker dat u alle illustratiepunten wilt wissen?", messageBoxText);
+
+ Assert.IsTrue(calculationWithOutput.HasOutput);
+ Assert.IsTrue(calculationWithIllustrationPoints.Output.HasGeneralResult);
+ }
+ }
+ }
+
+ [Test]
+ public void GivenCalculationsWithIllustrationPoints_WhenClearIllustrationPointsClickedAndContinued_ThenInquiryAndIllustrationPointsCleared()
+ {
+ // Given
+ var calculationWithIllustrationPoints = new TestClosingStructuresCalculationScenario
+ {
+ Output = new TestStructuresOutput(new TestGeneralResultFaultTreeIllustrationPoint())
+ };
+
+ var calculationWithOutput = new TestClosingStructuresCalculationScenario
+ {
+ Output = new TestStructuresOutput()
+ };
+
+ var failureMechanism = new ClosingStructuresFailureMechanism
+ {
+ CalculationsGroup =
+ {
+ Children =
+ {
+ calculationWithIllustrationPoints,
+ calculationWithOutput,
+ new TestClosingStructuresCalculationScenario()
+ }
+ }
+ };
+
+ var affectedCalculationObserver = mocksRepository.StrictMock();
+ affectedCalculationObserver.Expect(o => o.UpdateObserver());
+ calculationWithIllustrationPoints.Attach(affectedCalculationObserver);
+
+ var unaffectedCalculationObserver = mocksRepository.StrictMock();
+ calculationWithOutput.Attach(unaffectedCalculationObserver);
+
+ IAssessmentSection assessmentSection = AssessmentSectionTestHelper.CreateAssessmentSectionStub(null, mocksRepository, "invalidFilePath");
+
+ var nodeData = new ClosingStructuresFailureMechanismContext(failureMechanism, assessmentSection);
+ var menuBuilder = new CustomItemsOnlyContextMenuBuilder();
+
+ var messageBoxText = "";
+ DialogBoxHandler = (name, wnd) =>
+ {
+ var helper = new MessageBoxTester(wnd);
+ messageBoxText = helper.Text;
+
+ helper.ClickOk();
+ };
+
+ using (var treeViewControl = new TreeViewControl())
+ {
+ var gui = mocksRepository.Stub();
+ gui.Stub(g => g.Get(nodeData, treeViewControl)).Return(menuBuilder);
+ gui.Stub(g => g.MainWindow).Return(mocksRepository.Stub());
+ mocksRepository.ReplayAll();
+
+ plugin.Gui = gui;
+
+ using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl))
+ {
+ // When
+ contextMenu.Items[contextMenuClearIllustrationPointsIndex].PerformClick();
+
+ // Then
+ Assert.AreEqual("Weet u zeker dat u alle illustratiepunten wilt wissen?", messageBoxText);
+
+ Assert.IsTrue(calculationWithOutput.HasOutput);
+ Assert.IsFalse(calculationWithIllustrationPoints.Output.HasGeneralResult);
+ }
+ }
+ }
+
+ public override void Setup()
+ {
+ mocksRepository = new MockRepository();
+ plugin = new ClosingStructuresPlugin();
+ info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(ClosingStructuresFailureMechanismContext));
+ }
+
+ public override void TearDown()
+ {
+ plugin.Dispose();
+
+ mocksRepository.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 28bcfbdfd620734930c60df8d0963b3b4b58fa7a refers to a dead (removed) revision in file `Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Plugin.Test/ViewInfos/CalculationState/ClosingStructuresFailureMechanismViewInfoTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Plugin.Test/ViewInfos/CalculationsState/ClosingStructuresFailureMechanismViewInfoTest.cs
===================================================================
diff -u
--- Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Plugin.Test/ViewInfos/CalculationsState/ClosingStructuresFailureMechanismViewInfoTest.cs (revision 0)
+++ Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Plugin.Test/ViewInfos/CalculationsState/ClosingStructuresFailureMechanismViewInfoTest.cs (revision 28bcfbdfd620734930c60df8d0963b3b4b58fa7a)
@@ -0,0 +1,106 @@
+// Copyright (C) Stichting Deltares 2021. All rights reserved.
+//
+// This file is part of Riskeer.
+//
+// Riskeer 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.Linq;
+using System.Threading;
+using System.Windows.Forms;
+using Core.Gui.Plugin;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Riskeer.ClosingStructures.Data;
+using Riskeer.ClosingStructures.Forms.PresentationObjects.CalculationsState;
+using Riskeer.ClosingStructures.Forms.Views.CalculationsState;
+using Riskeer.Common.Data.AssessmentSection;
+using Riskeer.Common.Data.TestUtil;
+
+namespace Riskeer.ClosingStructures.Plugin.Test.ViewInfos.CalculationsState
+{
+ [TestFixture]
+ public class ClosingStructuresFailureMechanismViewInfoTest
+ {
+ private MockRepository mocks;
+ private ClosingStructuresPlugin plugin;
+ private ViewInfo info;
+
+ [SetUp]
+ public void SetUp()
+ {
+ mocks = new MockRepository();
+ plugin = new ClosingStructuresPlugin();
+ info = plugin.GetViewInfos().First(tni => tni.ViewType == typeof(ClosingStructuresFailureMechanismView));
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ plugin.Dispose();
+ }
+
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Assert
+ Assert.AreEqual(typeof(ClosingStructuresFailureMechanismContext), info.DataType);
+ Assert.AreEqual(typeof(ClosingStructuresFailureMechanismContext), info.ViewDataType);
+ }
+
+ [Test]
+ public void GetViewName_WithContext_ReturnsNameOfFailureMechanism()
+ {
+ // Setup
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new ClosingStructuresFailureMechanism();
+ var context = new ClosingStructuresFailureMechanismContext(failureMechanism, assessmentSection);
+
+ // Call
+ string viewName = info.GetViewName(null, context);
+
+ // Assert
+ Assert.AreEqual(failureMechanism.Name, viewName);
+ }
+
+ [Test]
+ [Apartment(ApartmentState.STA)]
+ public void CreateInstance_WithContext_ReturnClosingStructuresFailureMechanismView()
+ {
+ // Setup
+ var assessmentSection = new AssessmentSectionStub();
+ var failureMechanism = new ClosingStructuresFailureMechanism();
+
+ var context = new ClosingStructuresFailureMechanismContext(failureMechanism, assessmentSection);
+
+ using (var testForm = new Form())
+ {
+ // Call
+ var view = info.CreateInstance(context) as ClosingStructuresFailureMechanismView;
+
+ testForm.Controls.Add(view);
+ testForm.Show();
+
+ // Assert
+ Assert.AreSame(failureMechanism, view.FailureMechanism);
+ Assert.AreSame(assessmentSection, view.AssessmentSection);
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Plugin.Test/ViewInfos/ClosingStructuresCalculationsViewInfoTest.cs
===================================================================
diff -u -r436a226ddd1cd4d55203bd8239ce8a63ae0e7889 -r28bcfbdfd620734930c60df8d0963b3b4b58fa7a
--- Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Plugin.Test/ViewInfos/ClosingStructuresCalculationsViewInfoTest.cs (.../ClosingStructuresCalculationsViewInfoTest.cs) (revision 436a226ddd1cd4d55203bd8239ce8a63ae0e7889)
+++ Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Plugin.Test/ViewInfos/ClosingStructuresCalculationsViewInfoTest.cs (.../ClosingStructuresCalculationsViewInfoTest.cs) (revision 28bcfbdfd620734930c60df8d0963b3b4b58fa7a)
@@ -25,7 +25,7 @@
using Rhino.Mocks;
using Riskeer.ClosingStructures.Data;
using Riskeer.ClosingStructures.Forms.PresentationObjects;
-using Riskeer.ClosingStructures.Forms.PresentationObjects.CalculationState;
+using Riskeer.ClosingStructures.Forms.PresentationObjects.CalculationsState;
using Riskeer.ClosingStructures.Forms.Views;
using Riskeer.Common.Data.AssessmentSection;
using Riskeer.Common.Data.Calculation;
Index: Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs
===================================================================
diff -u -r436a226ddd1cd4d55203bd8239ce8a63ae0e7889 -r28bcfbdfd620734930c60df8d0963b3b4b58fa7a
--- Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs (.../RiskeerPlugin.cs) (revision 436a226ddd1cd4d55203bd8239ce8a63ae0e7889)
+++ Riskeer/Integration/src/Riskeer.Integration.Plugin/RiskeerPlugin.cs (.../RiskeerPlugin.cs) (revision 28bcfbdfd620734930c60df8d0963b3b4b58fa7a)
@@ -98,7 +98,7 @@
using Riskeer.StabilityPointStructures.Forms.PresentationObjects;
using Riskeer.StabilityStoneCover.Forms.PresentationObjects;
using Riskeer.WaveImpactAsphaltCover.Forms.PresentationObjects;
-using ClosingStructuresCalculationStateFailureMechanismContext = Riskeer.ClosingStructures.Forms.PresentationObjects.CalculationState.ClosingStructuresFailureMechanismContext;
+using ClosingStructuresCalculationsStateFailureMechanismContext = Riskeer.ClosingStructures.Forms.PresentationObjects.CalculationsState.ClosingStructuresFailureMechanismContext;
using ClosingStructuresRegistrationStateFailureMechanismContext = Riskeer.ClosingStructures.Forms.PresentationObjects.RegistrationState.ClosingStructuresFailureMechanismContext;
using CoreGuiResources = Core.Gui.Properties.Resources;
using FontFamily = System.Windows.Media.FontFamily;
@@ -1778,7 +1778,7 @@
new GrassCoverErosionInwardsCalculationsContext(assessmentSection.GrassCoverErosionInwards, assessmentSection),
new MacroStabilityInwardsCalculationsContext(assessmentSection.MacroStabilityInwards, assessmentSection),
new HeightStructuresCalculationsContext(assessmentSection.HeightStructures, assessmentSection),
- new ClosingStructuresCalculationStateFailureMechanismContext(assessmentSection.ClosingStructures, assessmentSection),
+ new ClosingStructuresCalculationsStateFailureMechanismContext(assessmentSection.ClosingStructures, assessmentSection),
new StabilityPointStructuresCalculationsContext(assessmentSection.StabilityPointStructures, assessmentSection)
};
}
Index: Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/TreeNodeInfos/CalculationsStateRootContextTreeNodeInfoTest.cs
===================================================================
diff -u -r436a226ddd1cd4d55203bd8239ce8a63ae0e7889 -r28bcfbdfd620734930c60df8d0963b3b4b58fa7a
--- Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/TreeNodeInfos/CalculationsStateRootContextTreeNodeInfoTest.cs (.../CalculationsStateRootContextTreeNodeInfoTest.cs) (revision 436a226ddd1cd4d55203bd8239ce8a63ae0e7889)
+++ Riskeer/Integration/test/Riskeer.Integration.Plugin.Test/TreeNodeInfos/CalculationsStateRootContextTreeNodeInfoTest.cs (.../CalculationsStateRootContextTreeNodeInfoTest.cs) (revision 28bcfbdfd620734930c60df8d0963b3b4b58fa7a)
@@ -30,7 +30,7 @@
using Core.Gui.TestUtil.ContextMenu;
using NUnit.Framework;
using Rhino.Mocks;
-using Riskeer.ClosingStructures.Forms.PresentationObjects.CalculationState;
+using Riskeer.ClosingStructures.Forms.PresentationObjects.CalculationsState;
using Riskeer.Common.Data.AssessmentSection;
using Riskeer.Common.Plugin.TestUtil;
using Riskeer.GrassCoverErosionInwards.Forms.PresentationObjects;