Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/MStabParameters.cs
===================================================================
diff -u -r2511 -r3121
--- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/MStabParameters.cs (.../MStabParameters.cs) (revision 2511)
+++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/MStabParameters.cs (.../MStabParameters.cs) (revision 3121)
@@ -635,7 +635,7 @@
this.IsCalculateAllStabilityProjectsAtOnce = true;
this.IsOverrulePLLineCreationMethod = false;
this.PLLineCreationMethod = PLLineCreationMethod.ExpertKnowledgeRRD;
- this.Model = MStabModelType.Bishop;
+ this.Model = MStabModelType.UpliftVan;
this.SearchMethod = MStabSearchMethod.Grid;
this.ZoneAreas = null;
this.gridPosition = MStabGridPosition.Right;
Index: DamClients/DamUI/trunk/src/Dam/Tests/MStabParametersTest.cs
===================================================================
diff -u
--- DamClients/DamUI/trunk/src/Dam/Tests/MStabParametersTest.cs (revision 0)
+++ DamClients/DamUI/trunk/src/Dam/Tests/MStabParametersTest.cs (revision 3121)
@@ -0,0 +1,55 @@
+// Copyright (C) Stichting Deltares 2020. All rights reserved.
+//
+// This file is part of the application DAM - UI.
+//
+// DAM - UI 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 Deltares.Dam.Data;
+using Deltares.Standard;
+using NUnit.Framework;
+
+namespace Deltares.Dam.Tests
+{
+ [TestFixture]
+ public class MStabParametersTest
+ {
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Call
+ var parameters = new MStabParameters();
+
+ // Assert
+ Assert.That(parameters, Is.InstanceOf>());
+ Assert.That(parameters, Is.InstanceOf());
+
+ Assert.That(parameters.IsCalculateAllStabilityProjectsAtOnce, Is.True);
+ Assert.That(parameters.IsOverrulePLLineCreationMethod, Is.False);
+ Assert.That(parameters.PLLineCreationMethod, Is.EqualTo(PLLineCreationMethod.ExpertKnowledgeRRD));
+ Assert.That(parameters.Model, Is.EqualTo(MStabModelType.UpliftVan));
+ Assert.That(parameters.SearchMethod, Is.EqualTo(MStabSearchMethod.Grid));
+ Assert.That(parameters.ZoneAreas, Is.Null);
+ Assert.That(parameters.GridPosition, Is.EqualTo(MStabGridPosition.Right));
+ Assert.That(parameters.CalculationOptions, Is.Not.Null);
+ Assert.That(parameters.GeometryCreationOptions, Is.Not.Null);
+ Assert.That(parameters.SheetPiling, Is.Null);
+ Assert.That(parameters.HorizontalBalanceArea, Is.Not.Null);
+ Assert.That(parameters.SlipCircleDefinition, Is.Not.Null);
+ }
+ }
+}
\ No newline at end of file
Index: DamClients/DamUI/trunk/src/Dam/Tests/DamFailureMechanismeCalculationSpecificationTest.cs
===================================================================
diff -u
--- DamClients/DamUI/trunk/src/Dam/Tests/DamFailureMechanismeCalculationSpecificationTest.cs (revision 0)
+++ DamClients/DamUI/trunk/src/Dam/Tests/DamFailureMechanismeCalculationSpecificationTest.cs (revision 3121)
@@ -0,0 +1,110 @@
+// Copyright (C) Stichting Deltares 2020. All rights reserved.
+//
+// This file is part of the application DAM - UI.
+//
+// DAM - UI 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 Deltares.Dam.Data;
+using NUnit.Framework;
+
+namespace Deltares.Dam.Tests
+{
+ [TestFixture]
+ public class DamFailureMechanismeCalculationSpecificationTest
+ {
+ [Test]
+ [TestCase(FailureMechanismSystemType.StabilityInside)]
+ [TestCase(FailureMechanismSystemType.StabilityOutside)]
+ public void GivenSpecificationWithStabilityModel_WhenIsEnabledCalledWithCalculationModel_ThenReturnsFalse(
+ FailureMechanismSystemType failureMechanism)
+ {
+ // Given
+ var specification = new DamFailureMechanismeCalculationSpecification
+ {
+ FailureMechanismSystemType = failureMechanism
+ };
+
+ // When
+ bool isEnabled = specification.IsEnabled(nameof(specification.CalculationModel));
+
+ // Then
+ Assert.That(isEnabled, Is.False);
+ }
+
+ [Test]
+ [TestCase(null)]
+ [TestCase("")]
+ [TestCase(" ")]
+ [TestCase("Property")]
+ public void GivenSpecificationWithStabilityInside_WhenIsEnabledCalledWithOtherProperty_ThenReturnsTrue(
+ string property)
+ {
+ // Given
+ var specification = new DamFailureMechanismeCalculationSpecification
+ {
+ FailureMechanismSystemType = FailureMechanismSystemType.StabilityInside
+ };
+
+ // When
+ bool isEnabled = specification.IsEnabled(property);
+
+ // Then
+ Assert.That(isEnabled, Is.True);
+ }
+
+ [Test]
+ [TestCase(null)]
+ [TestCase("")]
+ [TestCase(" ")]
+ [TestCase("Property")]
+ public void GivenSpecificationWithStabilityOutside_WhenIsEnabledCalledWithOtherProperty_ThenReturnsTrue(
+ string property)
+ {
+ // Given
+ var specification = new DamFailureMechanismeCalculationSpecification
+ {
+ FailureMechanismSystemType = FailureMechanismSystemType.StabilityOutside
+ };
+
+ // When
+ bool isEnabled = specification.IsEnabled(property);
+
+ // Then
+ Assert.That(isEnabled, Is.True);
+ }
+
+ [Test]
+ [TestCase(FailureMechanismSystemType.Piping)]
+ [TestCase(FailureMechanismSystemType.FlowSlide)]
+ public void GivenSpecificationWithNotStabilityModel_WhenIsEnabledCalledWithCalculationModel_ThenReturnsTrue(
+ FailureMechanismSystemType failureMechanism)
+ {
+ // Given
+ var specification = new DamFailureMechanismeCalculationSpecification
+ {
+ FailureMechanismSystemType = failureMechanism
+ };
+
+ // When
+ bool isEnabled = specification.IsEnabled(nameof(specification.CalculationModel));
+
+ // Then
+ Assert.That(isEnabled, Is.True);
+ }
+ }
+}
\ No newline at end of file
Index: DamClients/DamUI/trunk/src/Dam/Tests/Deltares.Dam.Tests.csproj
===================================================================
diff -u -r3075 -r3121
--- DamClients/DamUI/trunk/src/Dam/Tests/Deltares.Dam.Tests.csproj (.../Deltares.Dam.Tests.csproj) (revision 3075)
+++ DamClients/DamUI/trunk/src/Dam/Tests/Deltares.Dam.Tests.csproj (.../Deltares.Dam.Tests.csproj) (revision 3121)
@@ -136,6 +136,7 @@
+
@@ -148,6 +149,7 @@
+
Index: DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamFailureMechanismeCalculationSpecification.cs
===================================================================
diff -u -r2513 -r3121
--- DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamFailureMechanismeCalculationSpecification.cs (.../DamFailureMechanismeCalculationSpecification.cs) (revision 2513)
+++ DamClients/DamUI/trunk/src/DamClientsLibrary/Deltares.Dam.Data/DamFailureMechanismeCalculationSpecification.cs (.../DamFailureMechanismeCalculationSpecification.cs) (revision 3121)
@@ -18,7 +18,7 @@
// 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;
using System.ComponentModel;
using System.Xml.Serialization;
@@ -30,8 +30,6 @@
namespace Deltares.Dam.Data
{
- using System;
-
///
///
///
@@ -125,7 +123,7 @@
///
/// The calculationmodel is only needed to support the selection of the modeltype in the UI. The dropdownlist
/// in the UI depends on this. This set can be filled with any proper types (for piping, stabilty etc) for any
- /// mechanisme instead of the fixed types per mechanisme.
+ /// mechanism instead of the fixed types per mechanism.
///
[XmlIgnore]
[Label("Model")]
@@ -221,9 +219,15 @@
}
}
-
public bool IsEnabled(string property)
{
+ if (Equals(nameof(CalculationModel), property)
+ && (FailureMechanismSystemType == FailureMechanismSystemType.StabilityOutside
+ || FailureMechanismSystemType == FailureMechanismSystemType.StabilityInside))
+ {
+ return false; // Disable model selection when stability is active, as only UpliftVan is currently supported.
+ }
+
return true;
}
@@ -232,12 +236,12 @@
switch (property)
{
case "FailureMechanismeParamatersMStab":
- switch (this.FailureMechanismSystemType)
+ switch (FailureMechanismSystemType)
{
- case Data.FailureMechanismSystemType.StabilityInside: return true;
- case Data.FailureMechanismSystemType.StabilityOutside: return true;
- case Data.FailureMechanismSystemType.HorizontalBalance: return false;
- case Data.FailureMechanismSystemType.Piping: return false;
+ case FailureMechanismSystemType.StabilityInside: return true;
+ case FailureMechanismSystemType.StabilityOutside: return true;
+ case FailureMechanismSystemType.HorizontalBalance: return false;
+ case FailureMechanismSystemType.Piping: return false;
default: return true;
}
default: return true;