Fisheye: Tag 74f93f3b2180bcdc755d7e87eaa0885cd6406a2e refers to a dead (removed) revision in file `Riskeer/Common/src/Riskeer.Common.Forms/Controls/LengthEffectSettingsControl.Designer.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 74f93f3b2180bcdc755d7e87eaa0885cd6406a2e refers to a dead (removed) revision in file `Riskeer/Common/src/Riskeer.Common.Forms/Controls/LengthEffectSettingsControl.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 74f93f3b2180bcdc755d7e87eaa0885cd6406a2e refers to a dead (removed) revision in file `Riskeer/Common/src/Riskeer.Common.Forms/Controls/LengthEffectSettingsControl.resx'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Riskeer/Common/src/Riskeer.Common.Forms/Controls/ScenarioConfigurationPerFailureMechanismSectionControl.Designer.cs
===================================================================
diff -u
--- Riskeer/Common/src/Riskeer.Common.Forms/Controls/ScenarioConfigurationPerFailureMechanismSectionControl.Designer.cs (revision 0)
+++ Riskeer/Common/src/Riskeer.Common.Forms/Controls/ScenarioConfigurationPerFailureMechanismSectionControl.Designer.cs (revision 74f93f3b2180bcdc755d7e87eaa0885cd6406a2e)
@@ -0,0 +1,163 @@
+// Copyright (C) Stichting Deltares and State of the Netherlands 2023. 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.ComponentModel;
+using System.Windows.Forms;
+
+namespace Riskeer.Common.Forms.Controls
+{
+ partial class ScenarioConfigurationPerFailureMechanismSectionControl
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private 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.components = new System.ComponentModel.Container();
+ this.tableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
+ this.parameterALabel = new System.Windows.Forms.Label();
+ this.lengthEffectNRoundedLabel = new System.Windows.Forms.Label();
+ this.lengthEffectNRoundedTextBox = new System.Windows.Forms.TextBox();
+ this.parameterATextBox = new System.Windows.Forms.TextBox();
+ this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components);
+ this.parameterAToolTip = new System.Windows.Forms.ToolTip(this.components);
+ this.lengthEffectNRoundedToolTip = new System.Windows.Forms.ToolTip(this.components);
+ this.tableLayoutPanel.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize) (this.errorProvider)).BeginInit();
+ this.SuspendLayout();
+ //
+ // tableLayoutPanel
+ //
+ this.tableLayoutPanel.AutoSize = true;
+ this.tableLayoutPanel.ColumnCount = 2;
+ this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
+ this.tableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
+ this.tableLayoutPanel.Controls.Add(this.parameterALabel, 0, 0);
+ this.tableLayoutPanel.Controls.Add(this.lengthEffectNRoundedLabel, 0, 1);
+ this.tableLayoutPanel.Controls.Add(this.lengthEffectNRoundedTextBox, 1, 1);
+ this.tableLayoutPanel.Controls.Add(this.parameterATextBox, 1, 0);
+ this.tableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.tableLayoutPanel.Location = new System.Drawing.Point(0, 0);
+ this.tableLayoutPanel.Name = "tableLayoutPanel";
+ this.tableLayoutPanel.RowCount = 2;
+ this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
+ this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
+ this.tableLayoutPanel.Size = new System.Drawing.Size(496, 150);
+ this.tableLayoutPanel.TabIndex = 0;
+ //
+ // parameterALabel
+ //
+ this.parameterALabel.AutoSize = true;
+ this.parameterALabel.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.parameterALabel.Location = new System.Drawing.Point(0, 3);
+ this.parameterALabel.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
+ this.parameterALabel.Name = "parameterALabel";
+ this.parameterALabel.Size = new System.Drawing.Size(166, 20);
+ this.parameterALabel.TabIndex = 0;
+ this.parameterALabel.Text = global::Riskeer.Common.Forms.Properties.Resources.Parameter_A_DisplayName;
+ this.parameterALabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ //
+ // lengthEffectNRoundedLabel
+ //
+ this.lengthEffectNRoundedLabel.AutoSize = true;
+ this.lengthEffectNRoundedLabel.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.lengthEffectNRoundedLabel.Location = new System.Drawing.Point(0, 29);
+ this.lengthEffectNRoundedLabel.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
+ this.lengthEffectNRoundedLabel.Name = "lengthEffectNRoundedLabel";
+ this.lengthEffectNRoundedLabel.Size = new System.Drawing.Size(166, 118);
+ this.lengthEffectNRoundedLabel.TabIndex = 1;
+ this.lengthEffectNRoundedLabel.Text = global::Riskeer.Common.Forms.Properties.Resources.LengthEffect_RoundedNSection_DisplayName;
+ this.lengthEffectNRoundedLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ //
+ // lengthEffectNRoundedTextBox
+ //
+ this.lengthEffectNRoundedTextBox.Dock = System.Windows.Forms.DockStyle.Left;
+ this.lengthEffectNRoundedTextBox.Enabled = false;
+ this.lengthEffectNRoundedTextBox.Location = new System.Drawing.Point(172, 29);
+ this.lengthEffectNRoundedTextBox.Name = "lengthEffectNRoundedTextBox";
+ this.lengthEffectNRoundedTextBox.Size = new System.Drawing.Size(69, 20);
+ this.lengthEffectNRoundedTextBox.TabIndex = 2;
+ //
+ // parameterATextBox
+ //
+ this.parameterATextBox.Dock = System.Windows.Forms.DockStyle.Left;
+ this.parameterATextBox.Enabled = false;
+ this.parameterATextBox.Location = new System.Drawing.Point(172, 3);
+ this.parameterATextBox.Name = "parameterATextBox";
+ this.parameterATextBox.Size = new System.Drawing.Size(69, 20);
+ this.parameterATextBox.TabIndex = 3;
+ this.parameterATextBox.KeyDown += ParameterATextBoxKeyDown;
+ this.parameterATextBox.Leave += ParameterATextBoxLeave;
+ //
+ // errorProvider
+ //
+ this.errorProvider.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.NeverBlink;
+ this.errorProvider.ContainerControl = this;
+ //
+ // parameterAToolTip
+ //
+ this.parameterAToolTip.AutoPopDelay = 5000;
+ this.parameterAToolTip.InitialDelay = 100;
+ this.parameterAToolTip.ReshowDelay = 100;
+ //
+ // lengthEffectNRoundedToolTip
+ //
+ this.lengthEffectNRoundedToolTip.AutoPopDelay = 5000;
+ this.lengthEffectNRoundedToolTip.InitialDelay = 100;
+ this.lengthEffectNRoundedToolTip.ReshowDelay = 100;
+ //
+ // ScenarioConfigurationPerFailureMechanismSectionControl
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.AutoSize = true;
+ this.Controls.Add(this.tableLayoutPanel);
+ this.Name = "ScenarioConfigurationPerFailureMechanismSectionControl";
+ this.Size = new System.Drawing.Size(496, 150);
+ this.tableLayoutPanel.ResumeLayout(false);
+ this.tableLayoutPanel.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize) (this.errorProvider)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+ }
+
+ private System.Windows.Forms.ToolTip parameterAToolTip;
+ private System.Windows.Forms.ToolTip lengthEffectNRoundedToolTip;
+
+ private System.Windows.Forms.Label parameterALabel;
+ private System.Windows.Forms.Label lengthEffectNRoundedLabel;
+ private System.Windows.Forms.TextBox lengthEffectNRoundedTextBox;
+ private System.Windows.Forms.TextBox parameterATextBox;
+
+ private System.Windows.Forms.TableLayoutPanel tableLayoutPanel;
+ private System.Windows.Forms.ErrorProvider errorProvider;
+
+ #endregion
+ }
+}
\ No newline at end of file
Index: Riskeer/Common/src/Riskeer.Common.Forms/Controls/ScenarioConfigurationPerFailureMechanismSectionControl.cs
===================================================================
diff -u
--- Riskeer/Common/src/Riskeer.Common.Forms/Controls/ScenarioConfigurationPerFailureMechanismSectionControl.cs (revision 0)
+++ Riskeer/Common/src/Riskeer.Common.Forms/Controls/ScenarioConfigurationPerFailureMechanismSectionControl.cs (revision 74f93f3b2180bcdc755d7e87eaa0885cd6406a2e)
@@ -0,0 +1,199 @@
+// Copyright (C) Stichting Deltares and State of the Netherlands 2023. 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.Windows.Forms;
+using Core.Common.Base.Data;
+using Core.Common.Base.Exceptions;
+using Core.Common.Base.Helpers;
+using Riskeer.Common.Data.FailureMechanism;
+using Riskeer.Common.Data.Probability;
+using Riskeer.Common.Forms.Properties;
+
+namespace Riskeer.Common.Forms.Controls
+{
+ ///
+ /// Control to display properties of the .
+ ///
+ public partial class ScenarioConfigurationPerFailureMechanismSectionControl : UserControl
+ {
+ private const int lengthEffectNNrOfDecimals = 2;
+
+ private readonly double b;
+ private ScenarioConfigurationPerFailureMechanismSection scenarioConfigurationPerFailureMechanismSection;
+
+ private bool isParameterAUpdating;
+
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The 'b' parameter used to factor in the 'length effect' when determining
+ /// the maximum tolerated probability of failure.
+ public ScenarioConfigurationPerFailureMechanismSectionControl(double b)
+ {
+ this.b = b;
+
+ InitializeComponent();
+ InitializeToolTips();
+ }
+
+ ///
+ /// Sets the data on the control.
+ ///
+ /// The scenario configuration to set on the control.
+ /// Thrown when
+ /// is null.
+ public void SetData(ScenarioConfigurationPerFailureMechanismSection scenarioConfiguration)
+ {
+ if (scenarioConfiguration == null)
+ {
+ throw new ArgumentNullException(nameof(scenarioConfiguration));
+ }
+
+ ClearParameterAErrorMessage();
+
+ scenarioConfigurationPerFailureMechanismSection = scenarioConfiguration;
+
+ UpdateScenarioConfigurationPerSectionData();
+
+ EnableControl();
+ }
+
+ ///
+ /// Clears the data on the control.
+ ///
+ public void ClearData()
+ {
+ isParameterAUpdating = true;
+ scenarioConfigurationPerFailureMechanismSection = null;
+
+ ClearParameterAErrorMessage();
+ ClearScenarioConfigurationPerSectionData();
+
+ DisableControl();
+
+ isParameterAUpdating = false;
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+
+ base.Dispose(disposing);
+ }
+
+ private void InitializeToolTips()
+ {
+ parameterAToolTip.SetToolTip(parameterALabel, Resources.Parameter_A_Description);
+ lengthEffectNRoundedToolTip.SetToolTip(lengthEffectNRoundedLabel, Resources.LengthEffect_RoundedNSection_Description);
+ }
+
+ private void ParameterATextBoxKeyDown(object sender, KeyEventArgs e)
+ {
+ if (e.KeyCode == Keys.Enter)
+ {
+ parameterALabel.Focus(); // Focus on different component to raise a leave event on the text box
+ e.Handled = true;
+ }
+
+ if (e.KeyCode == Keys.Escape)
+ {
+ ClearParameterAErrorMessage();
+ UpdateScenarioConfigurationPerSectionData();
+ e.Handled = true;
+ }
+ }
+
+ private void ParameterATextBoxLeave(object sender, EventArgs e)
+ {
+ ClearParameterAErrorMessage();
+ ProcessParameterATextBox();
+ }
+
+ private void ProcessParameterATextBox()
+ {
+ if (isParameterAUpdating)
+ {
+ return;
+ }
+
+ try
+ {
+ scenarioConfigurationPerFailureMechanismSection.A = (RoundedDouble) DoubleParsingHelper.Parse(parameterATextBox.Text);
+ scenarioConfigurationPerFailureMechanismSection.NotifyObservers();
+
+ UpdateScenarioConfigurationPerSectionData();
+ }
+ catch (Exception exception) when (exception is ArgumentOutOfRangeException
+ || exception is DoubleParsingException)
+ {
+ ClearNRoundedData();
+ SetParameterAErrorMessage(exception.Message);
+ parameterATextBox.Focus();
+ }
+ }
+
+ private void ClearScenarioConfigurationPerSectionData()
+ {
+ parameterATextBox.Text = string.Empty;
+ ClearNRoundedData();
+ }
+
+ private void ClearNRoundedData()
+ {
+ lengthEffectNRoundedTextBox.Text = string.Empty;
+ }
+
+ private void UpdateScenarioConfigurationPerSectionData()
+ {
+ parameterATextBox.Text = scenarioConfigurationPerFailureMechanismSection.A.ToString();
+
+ double n = scenarioConfigurationPerFailureMechanismSection.GetN(b);
+ lengthEffectNRoundedTextBox.Text = new RoundedDouble(lengthEffectNNrOfDecimals, n).ToString();
+ }
+
+ private void SetParameterAErrorMessage(string errorMessage)
+ {
+ errorProvider.SetIconPadding(parameterATextBox, 5);
+ errorProvider.SetError(parameterATextBox, errorMessage);
+ }
+
+ private void ClearParameterAErrorMessage()
+ {
+ errorProvider.SetError(parameterATextBox, string.Empty);
+ }
+
+ private void EnableControl()
+ {
+ parameterATextBox.Enabled = true;
+ parameterATextBox.Refresh();
+ }
+
+ private void DisableControl()
+ {
+ parameterATextBox.Enabled = false;
+ parameterATextBox.Refresh();
+ }
+ }
+}
\ No newline at end of file
Index: Riskeer/Common/src/Riskeer.Common.Forms/Controls/ScenarioConfigurationPerFailureMechanismSectionControl.resx
===================================================================
diff -u
--- Riskeer/Common/src/Riskeer.Common.Forms/Controls/ScenarioConfigurationPerFailureMechanismSectionControl.resx (revision 0)
+++ Riskeer/Common/src/Riskeer.Common.Forms/Controls/ScenarioConfigurationPerFailureMechanismSectionControl.resx (revision 74f93f3b2180bcdc755d7e87eaa0885cd6406a2e)
@@ -0,0 +1,129 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 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
+
+
+ 17, 17
+
+
+ 195, 17
+
+
+ 343, 17
+
+
\ No newline at end of file
Index: Riskeer/Common/src/Riskeer.Common.Forms/Riskeer.Common.Forms.csproj
===================================================================
diff -u -r40a40a6f35b1fdf12a7a926c3c5a9f6df7de4cb7 -r74f93f3b2180bcdc755d7e87eaa0885cd6406a2e
--- Riskeer/Common/src/Riskeer.Common.Forms/Riskeer.Common.Forms.csproj (.../Riskeer.Common.Forms.csproj) (revision 40a40a6f35b1fdf12a7a926c3c5a9f6df7de4cb7)
+++ Riskeer/Common/src/Riskeer.Common.Forms/Riskeer.Common.Forms.csproj (.../Riskeer.Common.Forms.csproj) (revision 74f93f3b2180bcdc755d7e87eaa0885cd6406a2e)
@@ -80,7 +80,7 @@
UserControl
-
+
UserControl
Fisheye: Tag 74f93f3b2180bcdc755d7e87eaa0885cd6406a2e refers to a dead (removed) revision in file `Riskeer/Common/test/Riskeer.Common.Forms.Test/Controls/LengthEffectSettingsControlTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Riskeer/Common/test/Riskeer.Common.Forms.Test/Controls/ScenarioConfigurationPerFailureMechanismSectionControlTest.cs
===================================================================
diff -u
--- Riskeer/Common/test/Riskeer.Common.Forms.Test/Controls/ScenarioConfigurationPerFailureMechanismSectionControlTest.cs (revision 0)
+++ Riskeer/Common/test/Riskeer.Common.Forms.Test/Controls/ScenarioConfigurationPerFailureMechanismSectionControlTest.cs (revision 74f93f3b2180bcdc755d7e87eaa0885cd6406a2e)
@@ -0,0 +1,503 @@
+// Copyright (C) Stichting Deltares and State of the Netherlands 2023. 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.Windows.Forms;
+using Core.Common.Base;
+using Core.Common.Base.Data;
+using Core.Common.Base.Geometry;
+using Core.Common.TestUtil;
+using Core.Common.Util.Reflection;
+using NUnit.Extensions.Forms;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Riskeer.Common.Data.FailureMechanism;
+using Riskeer.Common.Data.TestUtil;
+using Riskeer.Common.Forms.Controls;
+
+namespace Riskeer.Common.Forms.Test.Controls
+{
+ [TestFixture]
+ public class ScenarioConfigurationPerFailureMechanismSectionControlTest
+ {
+ private Form testForm;
+
+ [SetUp]
+ public void Setup()
+ {
+ testForm = new Form();
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ testForm.Dispose();
+ }
+
+ [Test]
+ public void Constructor_ControlsCorrectlyInitialized()
+ {
+ // Call
+ ShowScenarioConfigurationPerFailureMechanismSectionControl();
+
+ // Assert
+ Label parameterALabel = GetParameterALabel();
+ Assert.AreEqual("Mechanismegevoelige fractie a [-]", parameterALabel.Text);
+
+ Label lengthEffectNRoundedLabel = GetLengthEffectNRoundedLabel();
+ Assert.AreEqual("Lengte-effect parameter Nvak* [-]", lengthEffectNRoundedLabel.Text);
+
+ TextBox lengthEffectNRoundedTextBox = GetLengthEffectNRoundedTextBox();
+ Assert.IsFalse(lengthEffectNRoundedTextBox.Enabled);
+ }
+
+ [Test]
+ public void Constructor_ToolTipsCorrectlyInitialized()
+ {
+ // Call
+ ScenarioConfigurationPerFailureMechanismSectionControl view = ShowScenarioConfigurationPerFailureMechanismSectionControl();
+
+ // Assert
+ Label parameterALabel = GetParameterALabel();
+ var parameterAToolTip = TypeUtils.GetField(view, "parameterAToolTip");
+
+ Assert.AreEqual("Mechanismegevoelige fractie van het dijkvak.",
+ parameterAToolTip.GetToolTip(parameterALabel));
+ Assert.AreEqual(5000, parameterAToolTip.AutoPopDelay);
+ Assert.AreEqual(100, parameterAToolTip.InitialDelay);
+ Assert.AreEqual(100, parameterAToolTip.ReshowDelay);
+
+ Label lengthEffectNRoundedLabel = GetLengthEffectNRoundedLabel();
+ var lengthEffectNRoundedToolTip = TypeUtils.GetField(view, "lengthEffectNRoundedToolTip");
+ Assert.AreEqual("De parameter 'Nvak*' die het lengte-effect beschrijft in de berekening van de faalkans per vak in de semi-probabilistische toets.",
+ lengthEffectNRoundedToolTip.GetToolTip(lengthEffectNRoundedLabel));
+ Assert.AreEqual(5000, lengthEffectNRoundedToolTip.AutoPopDelay);
+ Assert.AreEqual(100, lengthEffectNRoundedToolTip.InitialDelay);
+ Assert.AreEqual(100, lengthEffectNRoundedToolTip.ReshowDelay);
+ }
+
+ [Test]
+ public void SetScenarioConfiguration_ScenarioConfigurationNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ ScenarioConfigurationPerFailureMechanismSectionControl control = ShowScenarioConfigurationPerFailureMechanismSectionControl();
+
+ // Call
+ void Call() => control.SetData(null);
+
+ // Assert
+ var exception = Assert.Throws(Call);
+ Assert.AreEqual("scenarioConfiguration", exception.ParamName);
+ }
+
+ [Test]
+ [SetCulture("nl-NL")]
+ public void GivenControl_WhenSettingConfiguration_ThenControlUpdated()
+ {
+ // Given
+ const double a = 0.7;
+ const double b = 300.0;
+
+ FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(new[]
+ {
+ new Point2D(0, 0),
+ new Point2D(100, 0)
+ });
+ var scenarioConfiguration = new TestScenarioConfigurationPerFailureMechanismSection(section, (RoundedDouble) a);
+
+ ScenarioConfigurationPerFailureMechanismSectionControl settingsControl = ShowScenarioConfigurationPerFailureMechanismSectionControl(b);
+
+ // Precondition
+ var parameterATextBox = (TextBox) GetParameterATextBoxTester().TheObject;
+ Assert.IsEmpty(parameterATextBox.Text);
+ Assert.IsFalse(parameterATextBox.Enabled);
+
+ TextBox lengthEffectNRoundedTextBox = GetLengthEffectNRoundedTextBox();
+ Assert.IsEmpty(lengthEffectNRoundedTextBox.Text);
+
+ // When
+ settingsControl.SetData(scenarioConfiguration);
+
+ // Then
+ Assert.AreEqual("0,700", parameterATextBox.Text);
+ Assert.IsTrue(parameterATextBox.Enabled);
+
+ Assert.AreEqual("1,23", lengthEffectNRoundedTextBox.Text);
+ }
+
+ [Test]
+ [SetCulture("nl-NL")]
+ public void GivenControlWithConfiguration_WhenClearingData_ThenControlUpdated()
+ {
+ // Given
+ const double a = 0.7;
+ const double b = 300.0;
+
+ FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(new[]
+ {
+ new Point2D(0, 0),
+ new Point2D(100, 0)
+ });
+ var scenarioConfiguration = new TestScenarioConfigurationPerFailureMechanismSection(section, (RoundedDouble) a);
+
+ ScenarioConfigurationPerFailureMechanismSectionControl settingsControl = ShowScenarioConfigurationPerFailureMechanismSectionControl(b);
+ settingsControl.SetData(scenarioConfiguration);
+
+ // Precondition
+ var parameterATextBox = (TextBox) GetParameterATextBoxTester().TheObject;
+ Assert.AreEqual("0,700", parameterATextBox.Text);
+ Assert.IsTrue(parameterATextBox.Enabled);
+
+ TextBox lengthEffectNRoundedTextBox = GetLengthEffectNRoundedTextBox();
+ Assert.AreEqual("1,23", lengthEffectNRoundedTextBox.Text);
+
+ // When
+ settingsControl.ClearData();
+
+ // Then
+ Assert.IsEmpty(parameterATextBox.Text);
+ Assert.IsFalse(parameterATextBox.Enabled);
+
+ Assert.IsEmpty(lengthEffectNRoundedTextBox.Text);
+ }
+
+ [Test]
+ public void GivenControlWithError_WhenClearingData_ThenErrorCleared()
+ {
+ // Given
+ var random = new Random(21);
+
+ FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
+ var scenarioConfiguration = new TestScenarioConfigurationPerFailureMechanismSection(section, random.NextRoundedDouble());
+
+ ScenarioConfigurationPerFailureMechanismSectionControl settingsControl = ShowScenarioConfigurationPerFailureMechanismSectionControl(random.NextDouble());
+ settingsControl.SetData(scenarioConfiguration);
+
+ TextBoxTester parameterATextBoxTester = GetParameterATextBoxTester();
+ parameterATextBoxTester.Enter("NotADouble");
+
+ // Precondition
+ ErrorProvider errorProvider = GetErrorProvider(settingsControl);
+ var parameterATextBox = (TextBox) GetParameterATextBoxTester().TheObject;
+ string errorMessage = errorProvider.GetError(parameterATextBox);
+ Assert.IsNotEmpty(errorMessage);
+
+ // When
+ settingsControl.ClearData();
+
+ // Then
+ errorMessage = errorProvider.GetError(parameterATextBox);
+ Assert.IsEmpty(errorMessage);
+ }
+
+ [Test]
+ public void GivenControlWithError_WhenEnteringValidData_ThenErrorClearedAndControlsUpdated()
+ {
+ // Given
+ var random = new Random(21);
+
+ FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
+ var scenarioConfiguration = new TestScenarioConfigurationPerFailureMechanismSection(section, random.NextRoundedDouble());
+
+ ScenarioConfigurationPerFailureMechanismSectionControl settingsControl = ShowScenarioConfigurationPerFailureMechanismSectionControl(random.NextDouble());
+ settingsControl.SetData(scenarioConfiguration);
+
+ TextBoxTester parameterATextBoxTester = GetParameterATextBoxTester();
+ parameterATextBoxTester.Enter("NotADouble");
+
+ // Precondition
+ ErrorProvider errorProvider = GetErrorProvider(settingsControl);
+ var parameterATextBox = (TextBox) GetParameterATextBoxTester().TheObject;
+ string errorMessage = errorProvider.GetError(parameterATextBox);
+ Assert.IsNotEmpty(errorMessage);
+
+ TextBox lengthEffectNRoundedTextBox = GetLengthEffectNRoundedTextBox();
+ Assert.IsEmpty(lengthEffectNRoundedTextBox.Text);
+
+ // When
+ parameterATextBoxTester.Enter("0,7");
+
+ // Then
+ errorMessage = errorProvider.GetError(parameterATextBox);
+ Assert.IsEmpty(errorMessage);
+ Assert.IsNotEmpty(lengthEffectNRoundedTextBox.Text);
+ }
+
+ [Test]
+ public void GivenControlWithError_WhenSettingData_ThenErrorCleared()
+ {
+ // Given
+ var random = new Random(21);
+
+ FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
+ var scenarioConfiguration = new TestScenarioConfigurationPerFailureMechanismSection(section, random.NextRoundedDouble());
+
+ ScenarioConfigurationPerFailureMechanismSectionControl settingsControl = ShowScenarioConfigurationPerFailureMechanismSectionControl(random.NextDouble());
+ settingsControl.SetData(scenarioConfiguration);
+
+ TextBoxTester parameterATextBoxTester = GetParameterATextBoxTester();
+ parameterATextBoxTester.Enter("NotADouble");
+
+ // Precondition
+ ErrorProvider errorProvider = GetErrorProvider(settingsControl);
+ var parameterATextBox = (TextBox) GetParameterATextBoxTester().TheObject;
+ string errorMessage = errorProvider.GetError(parameterATextBox);
+ Assert.IsNotEmpty(errorMessage);
+
+ // When
+ var newConfiguration = new TestScenarioConfigurationPerFailureMechanismSection(FailureMechanismSectionTestFactory.CreateFailureMechanismSection(),
+ random.NextRoundedDouble());
+ settingsControl.SetData(newConfiguration);
+
+ // Then
+ errorMessage = errorProvider.GetError(parameterATextBox);
+ Assert.IsEmpty(errorMessage);
+ }
+
+ [Test]
+ public void GivenControlWithoutError_WhenEnteringInvalidData_ThenErrorSetAndControlsUpdated()
+ {
+ // Given
+ var random = new Random(21);
+
+ FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
+ var scenarioConfiguration = new TestScenarioConfigurationPerFailureMechanismSection(section, random.NextRoundedDouble());
+
+ ScenarioConfigurationPerFailureMechanismSectionControl settingsControl = ShowScenarioConfigurationPerFailureMechanismSectionControl(random.NextDouble());
+ settingsControl.SetData(scenarioConfiguration);
+
+ TextBoxTester parameterATextBoxTester = GetParameterATextBoxTester();
+
+ // Precondition
+ ErrorProvider errorProvider = GetErrorProvider(settingsControl);
+ var parameterATextBox = (TextBox) GetParameterATextBoxTester().TheObject;
+ string errorMessage = errorProvider.GetError(parameterATextBox);
+ Assert.IsEmpty(errorMessage);
+
+ TextBox lengthEffectNRoundedTextBox = GetLengthEffectNRoundedTextBox();
+ Assert.IsNotEmpty(lengthEffectNRoundedTextBox.Text);
+
+ // When
+ parameterATextBoxTester.Enter("NotADouble");
+
+ // Then
+ errorMessage = errorProvider.GetError(parameterATextBox);
+ Assert.IsNotEmpty(errorMessage);
+ Assert.IsEmpty(lengthEffectNRoundedTextBox.Text);
+ }
+
+ [Test]
+ public void GivenControlWithConfiguration_WhenSettingNewAValue_ThenControlsUpdatedAndObserversNotified()
+ {
+ // Given
+ const double a = 0.4;
+ const double b = 300;
+
+ var mocks = new MockRepository();
+ var observer = mocks.StrictMock();
+ observer.Expect(o => o.UpdateObserver());
+ mocks.ReplayAll();
+
+ FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(new[]
+ {
+ new Point2D(0, 0),
+ new Point2D(100, 0)
+ });
+ var scenarioConfiguration = new TestScenarioConfigurationPerFailureMechanismSection(section, (RoundedDouble) a);
+ scenarioConfiguration.Attach(observer);
+
+ ScenarioConfigurationPerFailureMechanismSectionControl settingsControl = ShowScenarioConfigurationPerFailureMechanismSectionControl(b);
+ settingsControl.SetData(scenarioConfiguration);
+
+ // Precondition
+ TextBoxTester parameterATextBoxTester = GetParameterATextBoxTester();
+ Assert.AreEqual("0,400", parameterATextBoxTester.Text);
+
+ TextBox lengthEffectNRoundedTextBox = GetLengthEffectNRoundedTextBox();
+ Assert.AreEqual("1,13", lengthEffectNRoundedTextBox.Text);
+
+ // When
+ parameterATextBoxTester.Enter("0,7");
+
+ // Then
+ Assert.AreEqual("1,23", lengthEffectNRoundedTextBox.Text);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ [SetCulture("nl-NL")]
+ public void GivenControlWithConfiguration_WhenSettingInvalidAValueAndEscPressed_ThenControlsSetToInitialValue()
+ {
+ // Given
+ var mocks = new MockRepository();
+ var observer = mocks.StrictMock();
+ mocks.ReplayAll();
+
+ const double a = 0.4;
+ const string initialAValue = "0,400";
+ const double b = 300;
+ const string lengthEffectNRoundedValue = "1,13";
+
+ FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(new[]
+ {
+ new Point2D(0, 0),
+ new Point2D(100, 0)
+ });
+ var scenarioConfiguration = new TestScenarioConfigurationPerFailureMechanismSection(section, (RoundedDouble) a);
+ scenarioConfiguration.Attach(observer);
+
+ ScenarioConfigurationPerFailureMechanismSectionControl settingsControl = ShowScenarioConfigurationPerFailureMechanismSectionControl(b);
+ settingsControl.SetData(scenarioConfiguration);
+
+ TextBoxTester parameterATextBoxTester = GetParameterATextBoxTester();
+ const Keys keyData = Keys.Escape;
+
+ var parameterATextBox = (TextBox) parameterATextBoxTester.TheObject;
+ parameterATextBox.TextChanged += (sender, args) =>
+ {
+ parameterATextBoxTester.FireEvent("KeyDown", new KeyEventArgs(keyData));
+ };
+
+ // Precondition
+ Assert.AreEqual(initialAValue, parameterATextBoxTester.Text);
+
+ TextBox lengthEffectNRoundedTextBox = GetLengthEffectNRoundedTextBox();
+ Assert.AreEqual(lengthEffectNRoundedValue, lengthEffectNRoundedTextBox.Text);
+
+ // When
+ parameterATextBox.Text = "NotAValue";
+
+ // Then
+ Assert.AreEqual(initialAValue, parameterATextBoxTester.Text);
+ Assert.AreEqual(lengthEffectNRoundedValue, lengthEffectNRoundedTextBox.Text);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void GivenControlWithConfiguration_WhenDataClearedAndConfigurationNotifiesObservers_ThenControlsNotUpdated()
+ {
+ // Given
+ const double a = 0.4;
+ const double b = 300;
+
+ FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(new[]
+ {
+ new Point2D(0, 0),
+ new Point2D(100, 0)
+ });
+ var scenarioConfiguration = new TestScenarioConfigurationPerFailureMechanismSection(section, (RoundedDouble) a);
+
+ ScenarioConfigurationPerFailureMechanismSectionControl settingsControl = ShowScenarioConfigurationPerFailureMechanismSectionControl(b);
+ settingsControl.SetData(scenarioConfiguration);
+
+ // Precondition
+ TextBoxTester parameterATextBoxTester = GetParameterATextBoxTester();
+ Assert.AreEqual("0,400", parameterATextBoxTester.Text);
+
+ TextBox lengthEffectNRoundedTextBox = GetLengthEffectNRoundedTextBox();
+ Assert.AreEqual("1,13", lengthEffectNRoundedTextBox.Text);
+
+ // When
+ settingsControl.ClearData();
+ scenarioConfiguration.A = (RoundedDouble) 0.7;
+ scenarioConfiguration.NotifyObservers();
+
+ // Then
+ Assert.IsEmpty(parameterATextBoxTester.Text);
+ Assert.IsEmpty(lengthEffectNRoundedTextBox.Text);
+ }
+
+ [Test]
+ public void GivenControlWithConfiguration_WhenSettingNewConfigurationAndOldConfigurationNotifiesObservers_ThenControlsNotUpdated()
+ {
+ // Given
+ const double a = 0.4;
+ const double b = 300;
+
+ FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(new[]
+ {
+ new Point2D(0, 0),
+ new Point2D(100, 0)
+ });
+ var oldConfiguration = new TestScenarioConfigurationPerFailureMechanismSection(section, (RoundedDouble) a);
+
+ ScenarioConfigurationPerFailureMechanismSectionControl settingsControl = ShowScenarioConfigurationPerFailureMechanismSectionControl(b);
+ settingsControl.SetData(oldConfiguration);
+
+ // Precondition
+ TextBoxTester parameterATextBoxTester = GetParameterATextBoxTester();
+ Assert.AreEqual("0,400", parameterATextBoxTester.Text);
+
+ TextBox lengthEffectNRoundedTextBox = GetLengthEffectNRoundedTextBox();
+ Assert.AreEqual("1,13", lengthEffectNRoundedTextBox.Text);
+
+ // When
+ var newConfiguration = new TestScenarioConfigurationPerFailureMechanismSection(section, (RoundedDouble) 0.7);
+ settingsControl.SetData(newConfiguration);
+ oldConfiguration.NotifyObservers();
+
+ // Then
+ Assert.AreEqual("0,700", parameterATextBoxTester.Text);
+ Assert.AreEqual("1,23", lengthEffectNRoundedTextBox.Text);
+ }
+
+ private static Label GetParameterALabel()
+ {
+ return (Label) new LabelTester("parameterALabel").TheObject;
+ }
+
+ private static Label GetLengthEffectNRoundedLabel()
+ {
+ return (Label) new LabelTester("lengthEffectNRoundedLabel").TheObject;
+ }
+
+ private static TextBoxTester GetParameterATextBoxTester()
+ {
+ return new TextBoxTester("parameterATextBox");
+ }
+
+ private static TextBox GetLengthEffectNRoundedTextBox()
+ {
+ return (TextBox) new ControlTester("lengthEffectNRoundedTextBox").TheObject;
+ }
+
+ private static ErrorProvider GetErrorProvider(ScenarioConfigurationPerFailureMechanismSectionControl settingsControl)
+ {
+ return TypeUtils.GetField(settingsControl, "errorProvider");
+ }
+
+ private ScenarioConfigurationPerFailureMechanismSectionControl ShowScenarioConfigurationPerFailureMechanismSectionControl()
+ {
+ var random = new Random(21);
+ return ShowScenarioConfigurationPerFailureMechanismSectionControl(random.NextDouble());
+ }
+
+ private ScenarioConfigurationPerFailureMechanismSectionControl ShowScenarioConfigurationPerFailureMechanismSectionControl(double b)
+ {
+ var control = new ScenarioConfigurationPerFailureMechanismSectionControl(b);
+
+ testForm.Controls.Add(control);
+ testForm.Show();
+
+ return control;
+ }
+ }
+}
\ No newline at end of file
Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsScenariosView.Designer.cs
===================================================================
diff -u -rd669c3342fcc3ef7cd94b231e962b827378fe0f6 -r74f93f3b2180bcdc755d7e87eaa0885cd6406a2e
--- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsScenariosView.Designer.cs (.../MacroStabilityInwardsScenariosView.Designer.cs) (revision d669c3342fcc3ef7cd94b231e962b827378fe0f6)
+++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsScenariosView.Designer.cs (.../MacroStabilityInwardsScenariosView.Designer.cs) (revision 74f93f3b2180bcdc755d7e87eaa0885cd6406a2e)
@@ -141,7 +141,7 @@
// calculationSettingsGroupBox
//
this.calculationSettingsGroupBox.AutoSize = true;
- this.calculationSettingsGroupBox.Controls.Add(this.lengthEffectSettingsControl);
+ this.calculationSettingsGroupBox.Controls.Add(this.scenarioConfigurationPerFailureMechanismSectionControl);
this.calculationSettingsGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.calculationSettingsGroupBox.Location = new System.Drawing.Point(3, 3);
this.calculationSettingsGroupBox.Name = "calculationSettingsGroupBox";
@@ -150,14 +150,14 @@
this.calculationSettingsGroupBox.TabStop = false;
this.calculationSettingsGroupBox.Text = global::Riskeer.Common.Forms.Properties.Resources.Calculation_settings_per_FailureMechanismSection_DisplayName;
//
- // lengthEffectSettingsControl
+ // scenarioConfigurationPerFailureMechanismSectionControl
//
- this.lengthEffectSettingsControl.AutoSize = true;
- this.lengthEffectSettingsControl.Dock = System.Windows.Forms.DockStyle.Fill;
- this.lengthEffectSettingsControl.Location = new System.Drawing.Point(3, 16);
- this.lengthEffectSettingsControl.Name = "lengthEffectSettingsControl";
- this.lengthEffectSettingsControl.Size = new System.Drawing.Size(991, 52);
- this.lengthEffectSettingsControl.TabIndex = 0;
+ this.scenarioConfigurationPerFailureMechanismSectionControl.AutoSize = true;
+ this.scenarioConfigurationPerFailureMechanismSectionControl.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.scenarioConfigurationPerFailureMechanismSectionControl.Location = new System.Drawing.Point(3, 16);
+ this.scenarioConfigurationPerFailureMechanismSectionControl.Name = "scenarioConfigurationPerFailureMechanismSectionControl";
+ this.scenarioConfigurationPerFailureMechanismSectionControl.Size = new System.Drawing.Size(991, 52);
+ this.scenarioConfigurationPerFailureMechanismSectionControl.TabIndex = 0;
//
// dataGridViewControlGroupBox
//
@@ -245,7 +245,7 @@
private System.Windows.Forms.TableLayoutPanel dataGridViewControlTableLayoutPanel;
private System.Windows.Forms.Label labelTotalScenarioContribution;
- private Riskeer.Common.Forms.Controls.LengthEffectSettingsControl lengthEffectSettingsControl;
+ private Riskeer.Common.Forms.Controls.ScenarioConfigurationPerFailureMechanismSectionControl scenarioConfigurationPerFailureMechanismSectionControl;
private System.Windows.Forms.GroupBox calculationSettingsGroupBox;
private System.Windows.Forms.GroupBox dataGridViewControlGroupBox;
Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsScenariosView.cs
===================================================================
diff -u -rd669c3342fcc3ef7cd94b231e962b827378fe0f6 -r74f93f3b2180bcdc755d7e87eaa0885cd6406a2e
--- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsScenariosView.cs (.../MacroStabilityInwardsScenariosView.cs) (revision d669c3342fcc3ef7cd94b231e962b827378fe0f6)
+++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Forms/Views/MacroStabilityInwardsScenariosView.cs (.../MacroStabilityInwardsScenariosView.cs) (revision 74f93f3b2180bcdc755d7e87eaa0885cd6406a2e)
@@ -83,7 +83,8 @@
InitializeObservers();
- lengthEffectSettingsControl = new LengthEffectSettingsControl(failureMechanism.GeneralInput.B);
+ scenarioConfigurationPerFailureMechanismSectionControl =
+ new ScenarioConfigurationPerFailureMechanismSectionControl(failureMechanism.GeneralInput.B);
InitializeComponent();
InitializeListBox();
@@ -294,11 +295,11 @@
private void UpdateLengthEffectControl()
{
- lengthEffectSettingsControl.ClearData();
+ scenarioConfigurationPerFailureMechanismSectionControl.ClearData();
if (selectedFailureMechanismSection != null)
{
- lengthEffectSettingsControl.SetData(selectedFailureMechanismSection.ScenarioConfigurationPerSection);
+ scenarioConfigurationPerFailureMechanismSectionControl.SetData(selectedFailureMechanismSection.ScenarioConfigurationPerSection);
}
}
}
Index: Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsScenariosViewTest.cs
===================================================================
diff -u -r2c3d6c0c61ee5252cacdcf66e9e616bd2c3e1ffa -r74f93f3b2180bcdc755d7e87eaa0885cd6406a2e
--- Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsScenariosViewTest.cs (.../MacroStabilityInwardsScenariosViewTest.cs) (revision 2c3d6c0c61ee5252cacdcf66e9e616bd2c3e1ffa)
+++ Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.Forms.Test/Views/MacroStabilityInwardsScenariosViewTest.cs (.../MacroStabilityInwardsScenariosViewTest.cs) (revision 74f93f3b2180bcdc755d7e87eaa0885cd6406a2e)
@@ -165,7 +165,7 @@
ShowMacroStabilityInwardsScenariosView(new MacroStabilityInwardsFailureMechanism());
// Assert
- LengthEffectSettingsControl lengthEffectSettingsControl = GetLengthEffectSettingsControl();
+ ScenarioConfigurationPerFailureMechanismSectionControl lengthEffectSettingsControl = GetScenarioConfigurationPerFailureMechanismSectionControl();
Assert.IsTrue(lengthEffectSettingsControl.Visible);
}
@@ -334,7 +334,7 @@
var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject;
TextBoxTester parameterATextBox = GetParameterATextBoxTester();
- LengthEffectSettingsControl lengthEffectSettingsControl = GetLengthEffectSettingsControl();
+ ScenarioConfigurationPerFailureMechanismSectionControl lengthEffectSettingsControl = GetScenarioConfigurationPerFailureMechanismSectionControl();
TextBox lengthEffectNRoundedTextBox = GetLengthEffectNRoundedTextBox(lengthEffectSettingsControl);
// Precondition
@@ -387,7 +387,7 @@
}
[Test]
- public void GivenMacroStabilityInwardsScenariosViewWithLengthEffectError_WhenSelectingDifferentItemInSectionsListBox_ThenErrorCleared()
+ public void GivenMacroStabilityInwardsScenariosViewWithScenarioConfigurationPerFailureMechanismSectionControlError_WhenSelectingDifferentItemInSectionsListBox_ThenErrorCleared()
{
// Setup
ShowFullyConfiguredMacroStabilityInwardsScenariosView();
@@ -396,8 +396,8 @@
textBoxTester.Enter("NotADouble");
// Precondition
- LengthEffectSettingsControl lengthEffectSettingsControl = GetLengthEffectSettingsControl();
- ErrorProvider errorProvider = GetLengthEffectErrorProvider(lengthEffectSettingsControl);
+ ScenarioConfigurationPerFailureMechanismSectionControl lengthEffectSettingsControl = GetScenarioConfigurationPerFailureMechanismSectionControl();
+ ErrorProvider errorProvider = GetParameterAErrorProvider(lengthEffectSettingsControl);
var parameterATextBox = (TextBox) textBoxTester.TheObject;
string errorMessage = errorProvider.GetError(parameterATextBox);
Assert.IsNotEmpty(errorMessage);
@@ -423,7 +423,7 @@
Assert.IsTrue(parameterATextBox.Enabled);
Assert.IsNotEmpty(parameterATextBox.Text);
- LengthEffectSettingsControl lengthEffectSettingsControl = GetLengthEffectSettingsControl();
+ ScenarioConfigurationPerFailureMechanismSectionControl lengthEffectSettingsControl = GetScenarioConfigurationPerFailureMechanismSectionControl();
TextBox lengthEffectNRoundedTextBox = GetLengthEffectNRoundedTextBox(lengthEffectSettingsControl);
Assert.IsNotEmpty(lengthEffectNRoundedTextBox.Text);
@@ -450,7 +450,7 @@
Assert.IsFalse(parameterATextBox.Enabled);
Assert.IsEmpty(parameterATextBox.Text);
- LengthEffectSettingsControl lengthEffectSettingsControl = GetLengthEffectSettingsControl();
+ ScenarioConfigurationPerFailureMechanismSectionControl lengthEffectSettingsControl = GetScenarioConfigurationPerFailureMechanismSectionControl();
TextBox lengthEffectNRoundedTextBox = GetLengthEffectNRoundedTextBox(lengthEffectSettingsControl);
Assert.IsEmpty(lengthEffectNRoundedTextBox.Text);
@@ -1020,16 +1020,16 @@
Assert.IsFalse(totalScenarioContributionLabel.Visible);
}
- private MacroStabilityInwardsScenariosView ShowFullyConfiguredMacroStabilityInwardsScenariosView()
+ private void ShowFullyConfiguredMacroStabilityInwardsScenariosView()
{
var failureMechanism = new MacroStabilityInwardsFailureMechanism();
- return ShowFullyConfiguredMacroStabilityInwardsScenariosView(failureMechanism);
+ ShowFullyConfiguredMacroStabilityInwardsScenariosView(failureMechanism);
}
- private MacroStabilityInwardsScenariosView ShowFullyConfiguredMacroStabilityInwardsScenariosView(MacroStabilityInwardsFailureMechanism failureMechanism)
+ private void ShowFullyConfiguredMacroStabilityInwardsScenariosView(MacroStabilityInwardsFailureMechanism failureMechanism)
{
ConfigureFailureMechanism(failureMechanism);
- return ShowMacroStabilityInwardsScenariosView(failureMechanism);
+ ShowMacroStabilityInwardsScenariosView(failureMechanism);
}
private static void ConfigureFailureMechanism(MacroStabilityInwardsFailureMechanism failureMechanism)
@@ -1130,25 +1130,25 @@
return TypeUtils.GetField(view, "errorProvider");
}
- private static ErrorProvider GetLengthEffectErrorProvider(LengthEffectSettingsControl settingsControl)
+ private static ErrorProvider GetParameterAErrorProvider(ScenarioConfigurationPerFailureMechanismSectionControl settingsControl)
{
- return TypeUtils.GetField(settingsControl, "lengthEffectErrorProvider");
+ return TypeUtils.GetField(settingsControl, "errorProvider");
}
private static TextBoxTester GetParameterATextBoxTester()
{
return new TextBoxTester("parameterATextBox");
}
- private static TextBox GetLengthEffectNRoundedTextBox(LengthEffectSettingsControl settingsControl)
+ private static TextBox GetLengthEffectNRoundedTextBox(ScenarioConfigurationPerFailureMechanismSectionControl settingsControl)
{
var tableLayoutPanel = (TableLayoutPanel) settingsControl.Controls["tableLayoutPanel"];
return (TextBox) tableLayoutPanel.GetControlFromPosition(1, 1);
}
- private static LengthEffectSettingsControl GetLengthEffectSettingsControl()
+ private static ScenarioConfigurationPerFailureMechanismSectionControl GetScenarioConfigurationPerFailureMechanismSectionControl()
{
- return (LengthEffectSettingsControl) new ControlTester("lengthEffectSettingsControl").TheObject;
+ return (ScenarioConfigurationPerFailureMechanismSectionControl) new ControlTester("scenarioConfigurationPerFailureMechanismSectionControl").TheObject;
}
#endregion
Index: Riskeer/Piping/src/Riskeer.Piping.Forms/Views/PipingScenariosView.Designer.cs
===================================================================
diff -u -rd669c3342fcc3ef7cd94b231e962b827378fe0f6 -r74f93f3b2180bcdc755d7e87eaa0885cd6406a2e
--- Riskeer/Piping/src/Riskeer.Piping.Forms/Views/PipingScenariosView.Designer.cs (.../PipingScenariosView.Designer.cs) (revision d669c3342fcc3ef7cd94b231e962b827378fe0f6)
+++ Riskeer/Piping/src/Riskeer.Piping.Forms/Views/PipingScenariosView.Designer.cs (.../PipingScenariosView.Designer.cs) (revision 74f93f3b2180bcdc755d7e87eaa0885cd6406a2e)
@@ -264,7 +264,7 @@
this.calculationSettingsTableLayoutPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.calculationSettingsTableLayoutPanel.ColumnCount = 1;
this.calculationSettingsTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
- this.calculationSettingsTableLayoutPanel.Controls.Add(this.lengthEffectSettingsControl, 0, 1);
+ this.calculationSettingsTableLayoutPanel.Controls.Add(this.scenarioConfigurationPerFailureMechanismSectionControl, 0, 1);
this.calculationSettingsTableLayoutPanel.Controls.Add(this.radioButtonsPanel, 0, 0);
this.calculationSettingsTableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.calculationSettingsTableLayoutPanel.Location = new System.Drawing.Point(3, 16);
@@ -275,15 +275,15 @@
this.calculationSettingsTableLayoutPanel.Size = new System.Drawing.Size(991, 87);
this.calculationSettingsTableLayoutPanel.TabIndex = 0;
//
- // lengthEffectSettingsControl
+ // scenarioConfigurationPerFailureMechanismSectionControl
//
- this.lengthEffectSettingsControl.AutoSize = true;
- this.lengthEffectSettingsControl.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
- this.lengthEffectSettingsControl.Dock = System.Windows.Forms.DockStyle.Fill;
- this.lengthEffectSettingsControl.Location = new System.Drawing.Point(3, 32);
- this.lengthEffectSettingsControl.Name = "lengthEffectSettingsControl";
- this.lengthEffectSettingsControl.Size = new System.Drawing.Size(985, 52);
- this.lengthEffectSettingsControl.TabIndex = 1;
+ this.scenarioConfigurationPerFailureMechanismSectionControl.AutoSize = true;
+ this.scenarioConfigurationPerFailureMechanismSectionControl.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.scenarioConfigurationPerFailureMechanismSectionControl.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.scenarioConfigurationPerFailureMechanismSectionControl.Location = new System.Drawing.Point(3, 32);
+ this.scenarioConfigurationPerFailureMechanismSectionControl.Name = "scenarioConfigurationPerFailureMechanismSectionControl";
+ this.scenarioConfigurationPerFailureMechanismSectionControl.Size = new System.Drawing.Size(985, 52);
+ this.scenarioConfigurationPerFailureMechanismSectionControl.TabIndex = 1;
//
// errorProvider
//
@@ -370,7 +370,7 @@
private System.Windows.Forms.TableLayoutPanel dataGridViewControlTableLayoutPanel;
- private Riskeer.Common.Forms.Controls.LengthEffectSettingsControl lengthEffectSettingsControl;
+ private Riskeer.Common.Forms.Controls.ScenarioConfigurationPerFailureMechanismSectionControl scenarioConfigurationPerFailureMechanismSectionControl;
private System.Windows.Forms.TableLayoutPanel calculationSettingsTableLayoutPanel;
Index: Riskeer/Piping/src/Riskeer.Piping.Forms/Views/PipingScenariosView.cs
===================================================================
diff -u -rd669c3342fcc3ef7cd94b231e962b827378fe0f6 -r74f93f3b2180bcdc755d7e87eaa0885cd6406a2e
--- Riskeer/Piping/src/Riskeer.Piping.Forms/Views/PipingScenariosView.cs (.../PipingScenariosView.cs) (revision d669c3342fcc3ef7cd94b231e962b827378fe0f6)
+++ Riskeer/Piping/src/Riskeer.Piping.Forms/Views/PipingScenariosView.cs (.../PipingScenariosView.cs) (revision 74f93f3b2180bcdc755d7e87eaa0885cd6406a2e)
@@ -102,7 +102,8 @@
InitializeObservers();
- lengthEffectSettingsControl = new LengthEffectSettingsControl(failureMechanism.GeneralInput.B);
+ scenarioConfigurationPerFailureMechanismSectionControl =
+ new ScenarioConfigurationPerFailureMechanismSectionControl(failureMechanism.GeneralInput.B);
InitializeComponent();
InitializeCombobox();
@@ -269,7 +270,7 @@
dataGridViewControl.GetColumnFromIndex(failureProbabilitySellmeijerColumnIndex).Visible = semiProbabilisticControlsVisible;
calculationSettingsGroupBox.Visible = failureMechanism.ScenarioConfigurationType != PipingScenarioConfigurationType.Probabilistic;
- lengthEffectSettingsControl.Visible = semiProbabilisticControlsVisible;
+ scenarioConfigurationPerFailureMechanismSectionControl.Visible = semiProbabilisticControlsVisible;
}
private void UpdateDataGridViewDataSource()
@@ -440,11 +441,11 @@
private void UpdateLengthEffectControl()
{
- lengthEffectSettingsControl.ClearData();
+ scenarioConfigurationPerFailureMechanismSectionControl.ClearData();
if (selectedFailureMechanismSection != null)
{
- lengthEffectSettingsControl.SetData(selectedFailureMechanismSection.ScenarioConfigurationPerSection);
+ scenarioConfigurationPerFailureMechanismSectionControl.SetData(selectedFailureMechanismSection.ScenarioConfigurationPerSection);
}
}
}
Index: Riskeer/Piping/test/Riskeer.Piping.Forms.Test/Views/PipingScenariosViewTest.cs
===================================================================
diff -u -r231d49a3680dfdeef619dcaa26c743a093716c71 -r74f93f3b2180bcdc755d7e87eaa0885cd6406a2e
--- Riskeer/Piping/test/Riskeer.Piping.Forms.Test/Views/PipingScenariosViewTest.cs (.../PipingScenariosViewTest.cs) (revision 231d49a3680dfdeef619dcaa26c743a093716c71)
+++ Riskeer/Piping/test/Riskeer.Piping.Forms.Test/Views/PipingScenariosViewTest.cs (.../PipingScenariosViewTest.cs) (revision 74f93f3b2180bcdc755d7e87eaa0885cd6406a2e)
@@ -229,7 +229,7 @@
var calculationSettingsGroupBox = (GroupBox) new ControlTester("calculationSettingsGroupBox").TheObject;
Assert.AreEqual(calculationSettingsVisible, calculationSettingsGroupBox.Visible);
- LengthEffectSettingsControl lengthEffectSettingsControl = GetLengthEffectSettingsControl();
+ ScenarioConfigurationPerFailureMechanismSectionControl lengthEffectSettingsControl = ScenarioConfigurationPerFailureMechanismSectionControl();
Assert.AreEqual(calculationSettingsVisible, lengthEffectSettingsControl.Visible);
bool radioButtonsShouldBeVisible = scenarioConfigurationType == PipingScenarioConfigurationType.PerFailureMechanismSection;
@@ -710,7 +710,7 @@
ShowPipingScenariosView(failureMechanism);
// Precondition
- LengthEffectSettingsControl lengthEffectSettingsControl = GetLengthEffectSettingsControl();
+ ScenarioConfigurationPerFailureMechanismSectionControl lengthEffectSettingsControl = ScenarioConfigurationPerFailureMechanismSectionControl();
bool initialSemiProbabilisticColumnShouldBeVisible = initialScenarioConfigurationType == PipingScenarioConfigurationPerFailureMechanismSectionType.SemiProbabilistic;
Assert.AreEqual(initialSemiProbabilisticColumnShouldBeVisible, lengthEffectSettingsControl.Visible);
@@ -809,7 +809,7 @@
var radioButtonSemiProbabilistic = (RadioButton) new RadioButtonTester("radioButtonSemiProbabilistic").TheObject;
var radioButtonProbabilistic = (RadioButton) new RadioButtonTester("radioButtonProbabilistic").TheObject;
- LengthEffectSettingsControl lengthEffectSettingsControl = GetLengthEffectSettingsControl();
+ ScenarioConfigurationPerFailureMechanismSectionControl lengthEffectSettingsControl = ScenarioConfigurationPerFailureMechanismSectionControl();
TextBoxTester parameterATextBox = GetParameterATextBoxTester();
TextBox lengthEffectNRoundedTextBox = GetLengthEffectNRoundedTextBox(lengthEffectSettingsControl);
@@ -867,7 +867,7 @@
}
[Test]
- public void GivenPipingScenariosViewWithLengthEffectError_WhenSelectingDifferentItemInSectionsListBox_ThenErrorCleared()
+ public void GivenPipingScenariosViewWithScenarioConfigurationPerFailureMechanismSectionControlError_WhenSelectingDifferentItemInSectionsListBox_ThenErrorCleared()
{
// Setup
ShowFullyConfiguredPipingScenariosView();
@@ -876,8 +876,8 @@
textBoxTester.Enter("NotADouble");
// Precondition
- LengthEffectSettingsControl lengthEffectSettingsControl = GetLengthEffectSettingsControl();
- ErrorProvider errorProvider = GetLengthEffectErrorProvider(lengthEffectSettingsControl);
+ ScenarioConfigurationPerFailureMechanismSectionControl lengthEffectSettingsControl = ScenarioConfigurationPerFailureMechanismSectionControl();
+ ErrorProvider errorProvider = GetParameterAErrorProvider(lengthEffectSettingsControl);
var parameterATextBox = (TextBox) textBoxTester.TheObject;
string errorMessage = errorProvider.GetError(parameterATextBox);
Assert.IsNotEmpty(errorMessage);
@@ -903,7 +903,7 @@
Assert.IsTrue(parameterATextBox.Enabled);
Assert.IsNotEmpty(parameterATextBox.Text);
- LengthEffectSettingsControl lengthEffectSettingsControl = GetLengthEffectSettingsControl();
+ ScenarioConfigurationPerFailureMechanismSectionControl lengthEffectSettingsControl = ScenarioConfigurationPerFailureMechanismSectionControl();
TextBox lengthEffectNRoundedTextBox = GetLengthEffectNRoundedTextBox(lengthEffectSettingsControl);
Assert.IsNotEmpty(lengthEffectNRoundedTextBox.Text);
@@ -930,7 +930,7 @@
Assert.IsFalse(parameterATextBox.Enabled);
Assert.IsEmpty(parameterATextBox.Text);
- LengthEffectSettingsControl lengthEffectSettingsControl = GetLengthEffectSettingsControl();
+ ScenarioConfigurationPerFailureMechanismSectionControl lengthEffectSettingsControl = ScenarioConfigurationPerFailureMechanismSectionControl();
TextBox lengthEffectNRoundedTextBox = GetLengthEffectNRoundedTextBox(lengthEffectSettingsControl);
Assert.IsEmpty(lengthEffectNRoundedTextBox.Text);
@@ -1845,25 +1845,25 @@
return TypeUtils.GetField(view, "errorProvider");
}
- private static ErrorProvider GetLengthEffectErrorProvider(LengthEffectSettingsControl settingsControl)
+ private static ErrorProvider GetParameterAErrorProvider(ScenarioConfigurationPerFailureMechanismSectionControl settingsControl)
{
- return TypeUtils.GetField(settingsControl, "lengthEffectErrorProvider");
+ return TypeUtils.GetField(settingsControl, "errorProvider");
}
private static TextBoxTester GetParameterATextBoxTester()
{
return new TextBoxTester("parameterATextBox");
}
- private static TextBox GetLengthEffectNRoundedTextBox(LengthEffectSettingsControl settingsControl)
+ private static TextBox GetLengthEffectNRoundedTextBox(ScenarioConfigurationPerFailureMechanismSectionControl settingsControl)
{
var tableLayoutPanel = (TableLayoutPanel) settingsControl.Controls["tableLayoutPanel"];
return (TextBox) tableLayoutPanel.GetControlFromPosition(1, 1);
}
- private static LengthEffectSettingsControl GetLengthEffectSettingsControl()
+ private static ScenarioConfigurationPerFailureMechanismSectionControl ScenarioConfigurationPerFailureMechanismSectionControl()
{
- return (LengthEffectSettingsControl) new ControlTester("lengthEffectSettingsControl").TheObject;
+ return (ScenarioConfigurationPerFailureMechanismSectionControl) new ControlTester("scenarioConfigurationPerFailureMechanismSectionControl").TheObject;
}
#endregion