Index: Ringtoets/Common/src/Ringtoets.Common.IO/Configurations/ConfigurationSchemaIdentifiers.cs
===================================================================
diff -u -rb3b6c13cf736c134476b3db34281332d01ca86b1 -r1a9817e6016b74559d10f1fddd5b5cd0f24b04f6
--- Ringtoets/Common/src/Ringtoets.Common.IO/Configurations/ConfigurationSchemaIdentifiers.cs (.../ConfigurationSchemaIdentifiers.cs) (revision b3b6c13cf736c134476b3db34281332d01ca86b1)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/Configurations/ConfigurationSchemaIdentifiers.cs (.../ConfigurationSchemaIdentifiers.cs) (revision 1a9817e6016b74559d10f1fddd5b5cd0f24b04f6)
@@ -185,5 +185,24 @@
public const string ForeshoreProfileNameElement = "voorlandprofiel";
#endregion
+
+ #region Scenario calculation
+
+ ///
+ /// The identifier for scenario elements.
+ ///
+ public const string ScenarioElement = "scenario";
+
+ ///
+ /// The identifier for the scenario contribution name.
+ ///
+ public const string ContributionScenarioName = "bijdrage";
+
+ ///
+ /// The identifier for the scenario relevance name.
+ ///
+ public const string IsRelevantScenarioName = "gebruik";
+
+ #endregion
}
}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.IO/Configurations/Helpers/ICalculationScenarioConversionExtensions.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.IO/Configurations/Helpers/ICalculationScenarioConversionExtensions.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/Configurations/Helpers/ICalculationScenarioConversionExtensions.cs (revision 1a9817e6016b74559d10f1fddd5b5cd0f24b04f6)
@@ -0,0 +1,57 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using Ringtoets.Common.Data.Calculation;
+
+namespace Ringtoets.Common.IO.Configurations.Helpers
+{
+ ///
+ /// Extension methods for converting to .
+ ///
+ public static class ICalculationScenarioConversionExtensions
+ {
+ ///
+ /// Configure a new with
+ /// and
+ /// taken from
+ /// .
+ ///
+ /// The calculation scenario to take the values from.
+ /// A new with
+ /// and
+ /// set.
+ /// Thrown when is null.
+ public static ScenarioConfiguration ToScenarioConfiguration(this ICalculationScenario calculationScenario)
+ {
+ if (calculationScenario == null)
+ {
+ throw new ArgumentNullException(nameof(calculationScenario));
+ }
+
+ return new ScenarioConfiguration
+ {
+ Contribution = calculationScenario.Contribution,
+ IsRelevant = calculationScenario.IsRelevant
+ };
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.IO/Configurations/ScenarioConfiguration.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.IO/Configurations/ScenarioConfiguration.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/Configurations/ScenarioConfiguration.cs (revision 1a9817e6016b74559d10f1fddd5b5cd0f24b04f6)
@@ -0,0 +1,39 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+namespace Ringtoets.Common.IO.Configurations
+{
+ ///
+ /// Configuration of a scenario with possible values for contribution and relevance.
+ ///
+ public class ScenarioConfiguration
+ {
+ ///
+ /// Gets or sets the contribution of the scenario.
+ ///
+ public double? Contribution { get; set; }
+
+ ///
+ /// Gets or sets whether this scenario is relevant or not.
+ ///
+ public bool? IsRelevant { get; set; }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.IO/Ringtoets.Common.IO.csproj
===================================================================
diff -u -re507c88f2863ff7bc93505caf71c5f8025fb48c0 -r1a9817e6016b74559d10f1fddd5b5cd0f24b04f6
--- Ringtoets/Common/src/Ringtoets.Common.IO/Ringtoets.Common.IO.csproj (.../Ringtoets.Common.IO.csproj) (revision e507c88f2863ff7bc93505caf71c5f8025fb48c0)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/Ringtoets.Common.IO.csproj (.../Ringtoets.Common.IO.csproj) (revision 1a9817e6016b74559d10f1fddd5b5cd0f24b04f6)
@@ -58,9 +58,11 @@
+
+
Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/Configurations/ConfigurationSchemaIdentifiersTest.cs
===================================================================
diff -u -rb3b6c13cf736c134476b3db34281332d01ca86b1 -r1a9817e6016b74559d10f1fddd5b5cd0f24b04f6
--- Ringtoets/Common/test/Ringtoets.Common.IO.Test/Configurations/ConfigurationSchemaIdentifiersTest.cs (.../ConfigurationSchemaIdentifiersTest.cs) (revision b3b6c13cf736c134476b3db34281332d01ca86b1)
+++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/Configurations/ConfigurationSchemaIdentifiersTest.cs (.../ConfigurationSchemaIdentifiersTest.cs) (revision 1a9817e6016b74559d10f1fddd5b5cd0f24b04f6)
@@ -35,10 +35,37 @@
Assert.AreEqual("map", ConfigurationSchemaIdentifiers.FolderElement);
Assert.AreEqual("naam", ConfigurationSchemaIdentifiers.NameAttribute);
Assert.AreEqual("hrlocatie", ConfigurationSchemaIdentifiers.HydraulicBoundaryLocationElement);
+ Assert.AreEqual("orientatie", ConfigurationSchemaIdentifiers.Orientation);
+
Assert.AreEqual("stochasten", ConfigurationSchemaIdentifiers.StochastsElement);
Assert.AreEqual("stochast", ConfigurationSchemaIdentifiers.StochastElement);
Assert.AreEqual("verwachtingswaarde", ConfigurationSchemaIdentifiers.MeanElement);
Assert.AreEqual("standaardafwijking", ConfigurationSchemaIdentifiers.StandardDeviationElement);
+ Assert.AreEqual("variatiecoefficient", ConfigurationSchemaIdentifiers.VariationCoefficientElement);
+ Assert.AreEqual("peilverhogingkomberging", ConfigurationSchemaIdentifiers.AllowedLevelIncreaseStorageStochastName);
+ Assert.AreEqual("kritiekinstromenddebiet", ConfigurationSchemaIdentifiers.CriticalOvertoppingDischargeStochastName);
+ Assert.AreEqual("modelfactoroverloopdebiet", ConfigurationSchemaIdentifiers.ModelFactorSuperCriticalFlowStochastName);
+ Assert.AreEqual("breedtebodembescherming", ConfigurationSchemaIdentifiers.FlowWidthAtBottomProtectionStochastName);
+ Assert.AreEqual("kombergendoppervlak", ConfigurationSchemaIdentifiers.StorageStructureAreaStochastName);
+ Assert.AreEqual("stormduur", ConfigurationSchemaIdentifiers.StormDurationStochastName);
+ Assert.AreEqual("breedtedoorstroomopening", ConfigurationSchemaIdentifiers.WidthFlowAperturesStochastName);
+
+ Assert.AreEqual("golfreductie", ConfigurationSchemaIdentifiers.WaveReduction);
+ Assert.AreEqual("damgebruiken", ConfigurationSchemaIdentifiers.UseBreakWater);
+ Assert.AreEqual("damtype", ConfigurationSchemaIdentifiers.BreakWaterType);
+ Assert.AreEqual("damhoogte", ConfigurationSchemaIdentifiers.BreakWaterHeight);
+ Assert.AreEqual("voorlandgebruiken", ConfigurationSchemaIdentifiers.UseForeshore);
+ Assert.AreEqual("caisson", ConfigurationSchemaIdentifiers.BreakWaterCaisson);
+ Assert.AreEqual("havendam", ConfigurationSchemaIdentifiers.BreakWaterDam);
+ Assert.AreEqual("verticalewand", ConfigurationSchemaIdentifiers.BreakWaterWall);
+
+ Assert.AreEqual("faalkansgegevenerosiebodem", ConfigurationSchemaIdentifiers.FailureProbabilityStructureWithErosionElement);
+ Assert.AreEqual("kunstwerk", ConfigurationSchemaIdentifiers.StructureElement);
+ Assert.AreEqual("voorlandprofiel", ConfigurationSchemaIdentifiers.ForeshoreProfileNameElement);
+
+ Assert.AreEqual("scenario", ConfigurationSchemaIdentifiers.ScenarioElement);
+ Assert.AreEqual("bijdrage", ConfigurationSchemaIdentifiers.ContributionScenarioName);
+ Assert.AreEqual("gebruik", ConfigurationSchemaIdentifiers.IsRelevantScenarioName);
}
}
}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/Configurations/Helpers/ICalculationScenarioConversionExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.IO.Test/Configurations/Helpers/ICalculationScenarioConversionExtensionsTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/Configurations/Helpers/ICalculationScenarioConversionExtensionsTest.cs (revision 1a9817e6016b74559d10f1fddd5b5cd0f24b04f6)
@@ -0,0 +1,70 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using Core.Common.Base.Data;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.Calculation;
+using Ringtoets.Common.IO.Configurations;
+using Ringtoets.Common.IO.Configurations.Helpers;
+
+namespace Ringtoets.Common.IO.Test.Configurations.Helpers
+{
+ [TestFixture]
+ public class ICalculationScenarioConversionExtensionsTest
+ {
+ [Test]
+ public void ToScenarioConfiguration_CalculationScenarioNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate test = () => ((ICalculationScenario) null).ToScenarioConfiguration();
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("calculationScenario", exception.ParamName);
+ }
+
+ [Test]
+ public void ToScenarioConfiguration_ValidCalculationScenario_InstanceWithExpectedParametersSet()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var scenario = mocks.Stub();
+ mocks.ReplayAll();
+
+ var random = new Random(21);
+ RoundedDouble contribution = random.NextRoundedDouble();
+ bool relevant = random.NextBoolean();
+
+ scenario.Contribution = contribution;
+ scenario.IsRelevant = relevant;
+
+ // Call
+ ScenarioConfiguration configuration = scenario.ToScenarioConfiguration();
+
+ // Assert
+ Assert.AreEqual(contribution, configuration.Contribution);
+ Assert.AreEqual(relevant, configuration.IsRelevant);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/Configurations/ScenarioConfigurationTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.IO.Test/Configurations/ScenarioConfigurationTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/Configurations/ScenarioConfigurationTest.cs (revision 1a9817e6016b74559d10f1fddd5b5cd0f24b04f6)
@@ -0,0 +1,62 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.IO.Configurations;
+
+namespace Ringtoets.Common.IO.Test.Configurations
+{
+ [TestFixture]
+ public class ScenarioConfigurationTest
+ {
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Call
+ var configuration = new ScenarioConfiguration();
+
+ // Assert
+ Assert.IsNull(configuration.Contribution);
+ Assert.IsNull(configuration.IsRelevant);
+ }
+
+ [Test]
+ public void SimpleProperties_SetNewValue_GetsNewlySetValue()
+ {
+ // Setup
+ var random = new Random(236789);
+ var configuration = new ScenarioConfiguration();
+
+ double contribution = random.NextDouble();
+ bool isRelevant = random.NextBoolean();
+
+ // Call
+ configuration.Contribution = contribution;
+ configuration.IsRelevant = isRelevant;
+
+ // Assert
+ Assert.AreEqual(contribution, configuration.Contribution);
+ Assert.AreEqual(isRelevant, configuration.IsRelevant);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/Ringtoets.Common.IO.Test.csproj
===================================================================
diff -u -re507c88f2863ff7bc93505caf71c5f8025fb48c0 -r1a9817e6016b74559d10f1fddd5b5cd0f24b04f6
--- Ringtoets/Common/test/Ringtoets.Common.IO.Test/Ringtoets.Common.IO.Test.csproj (.../Ringtoets.Common.IO.Test.csproj) (revision e507c88f2863ff7bc93505caf71c5f8025fb48c0)
+++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/Ringtoets.Common.IO.Test.csproj (.../Ringtoets.Common.IO.Test.csproj) (revision 1a9817e6016b74559d10f1fddd5b5cd0f24b04f6)
@@ -61,12 +61,14 @@
+
+
Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/Configurations/PipingCalculationConfiguration.cs
===================================================================
diff -u -r681fe6f5c04ea2acdb99801dd749a11a174d5b42 -r1a9817e6016b74559d10f1fddd5b5cd0f24b04f6
--- Ringtoets/Piping/src/Ringtoets.Piping.IO/Configurations/PipingCalculationConfiguration.cs (.../PipingCalculationConfiguration.cs) (revision 681fe6f5c04ea2acdb99801dd749a11a174d5b42)
+++ Ringtoets/Piping/src/Ringtoets.Piping.IO/Configurations/PipingCalculationConfiguration.cs (.../PipingCalculationConfiguration.cs) (revision 1a9817e6016b74559d10f1fddd5b5cd0f24b04f6)
@@ -25,7 +25,7 @@
namespace Ringtoets.Piping.IO.Configurations
{
///
- /// Configuration of a piping calculation.
+ /// Configuration of a piping calculation scenario.
///
public class PipingCalculationConfiguration : IConfigurationItem
{
@@ -87,6 +87,11 @@
public StochastConfiguration DampingFactorExit { get; set; }
///
+ /// Gets or sets the configuration of the scenario of the piping calculation.
+ ///
+ public ScenarioConfiguration Scenario { get; set; }
+
+ ///
/// Gets or sets the name of the piping calculation.
///
/// Thrown when is null.
Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Configurations/PipingCalculationConfigurationTest.cs
===================================================================
diff -u -r9d03e0c94adad4bcb57a0b7135f8891c255c5f52 -r1a9817e6016b74559d10f1fddd5b5cd0f24b04f6
--- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Configurations/PipingCalculationConfigurationTest.cs (.../PipingCalculationConfigurationTest.cs) (revision 9d03e0c94adad4bcb57a0b7135f8891c255c5f52)
+++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Configurations/PipingCalculationConfigurationTest.cs (.../PipingCalculationConfigurationTest.cs) (revision 1a9817e6016b74559d10f1fddd5b5cd0f24b04f6)
@@ -60,6 +60,7 @@
Assert.IsNull(readPipingCalculation.StochasticSoilProfileName);
Assert.IsNull(readPipingCalculation.PhreaticLevelExit);
Assert.IsNull(readPipingCalculation.DampingFactorExit);
+ Assert.IsNull(readPipingCalculation.Scenario);
}
[Test]
@@ -78,6 +79,8 @@
const double phreaticLevelExitStandardDeviation = 5.5;
const double dampingFactorExitMean = 6.6;
const double dampingFactorExitStandardDeviation = 7.7;
+ const double contribution = 8.8;
+ const bool isRelevant = false;
// Call
var readPipingCalculation = new PipingCalculationConfiguration(calculationName)
@@ -98,6 +101,11 @@
{
Mean = dampingFactorExitMean,
StandardDeviation = dampingFactorExitStandardDeviation
+ },
+ Scenario = new ScenarioConfiguration
+ {
+ Contribution = contribution,
+ IsRelevant = isRelevant
}
};
@@ -114,6 +122,8 @@
Assert.AreEqual(phreaticLevelExitStandardDeviation, readPipingCalculation.PhreaticLevelExit.StandardDeviation);
Assert.AreEqual(dampingFactorExitMean, readPipingCalculation.DampingFactorExit.Mean);
Assert.AreEqual(dampingFactorExitStandardDeviation, readPipingCalculation.DampingFactorExit.StandardDeviation);
+ Assert.AreEqual(contribution, readPipingCalculation.Scenario.Contribution);
+ Assert.AreEqual(isRelevant, readPipingCalculation.Scenario.IsRelevant);
}
[Test]