Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Common/HydraRingCalculationData.cs
===================================================================
diff -u
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Common/HydraRingCalculationData.cs (revision 0)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Common/HydraRingCalculationData.cs (revision 56f86024f7598b3d5dd16940ddfa96c4fc72592d)
@@ -0,0 +1,70 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using Ringtoets.HydraRing.Calculation.Types;
+
+namespace Ringtoets.HydraRing.Calculation.Common
+{
+ ///
+ /// Container of all data necessary for performing a Hydra-Ring calculation.
+ ///
+ public abstract class HydraRingCalculationData
+ {
+ private readonly int hydraulicBoundaryLocationId;
+
+ ///
+ /// Creates a new instance of the class.
+ ///
+ /// The id of the hydraulic station to use during the calculation.
+ protected HydraRingCalculationData(int hydraulicBoundaryLocationId)
+ {
+ this.hydraulicBoundaryLocationId = hydraulicBoundaryLocationId;
+ }
+
+ ///
+ /// Gets the .
+ ///
+ public abstract HydraRingFailureMechanismType FailureMechanismType { get; }
+
+ ///
+ /// Gets the id of the hydraulic station to use during the calculation.
+ ///
+ public int HydraulicBoundaryLocationId
+ {
+ get
+ {
+ return hydraulicBoundaryLocationId;
+ }
+ }
+
+ ///
+ /// Gets the target reliability index to use during the calculation.
+ ///
+ /// Only relevant for type 2 computations.
+ public virtual double Beta
+ {
+ get
+ {
+ return double.NaN;
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Common/HydraRingConfiguration.cs
===================================================================
diff -u
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Common/HydraRingConfiguration.cs (revision 0)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Common/HydraRingConfiguration.cs (revision 56f86024f7598b3d5dd16940ddfa96c4fc72592d)
@@ -0,0 +1,413 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using System.Globalization;
+using Ringtoets.HydraRing.Calculation.Settings;
+using Ringtoets.HydraRing.Calculation.Types;
+
+namespace Ringtoets.HydraRing.Calculation.Common
+{
+ ///
+ /// Container for all configurations that are necessary for performing a Hydra-Ring calculation.
+ /// The following Hydra-Ring features are not exposed (yet):
+ /// - Combination of multiple dike sections
+ /// - Coupling two hydraulic boundary stations
+ /// - Performing revetment calculations (DesignTables > LayerId)
+ /// - Performing piping calculations (DesignTables > AlternativeId)
+ /// - Type 3 computations (DesignTables > Method)
+ ///
+ public class HydraRingConfiguration
+ {
+ private readonly IList hydraRingCalculations;
+ private readonly SubMechanismSettingsProvider subMechanismSettingsProvider = new SubMechanismSettingsProvider();
+ private readonly FailureMechanismSettingsProvider failureMechanismSettingsProvider = new FailureMechanismSettingsProvider();
+ private readonly FailureMechanismDefaultsProvider failureMechanismDefaultsProvider = new FailureMechanismDefaultsProvider();
+ private readonly HydraRingTimeIntegrationSchemeType timeIntegrationSchemeType;
+ private readonly HydraRingUncertaintiesType uncertaintiesType;
+
+ ///
+ /// Creates a new instance of the class.
+ ///
+ /// The to use while executing the configured Hydra-Ring calculations.
+ /// The to use while executing the configured Hydra-Ring calculations.
+ public HydraRingConfiguration(HydraRingTimeIntegrationSchemeType timeIntegrationSchemeType, HydraRingUncertaintiesType uncertaintiesType)
+ {
+ hydraRingCalculations = new List();
+
+ this.timeIntegrationSchemeType = timeIntegrationSchemeType;
+ this.uncertaintiesType = uncertaintiesType;
+ }
+
+ ///
+ /// Gets the to use while executing the configured Hydra-Ring calculations.
+ ///
+ public HydraRingTimeIntegrationSchemeType? TimeIntegrationSchemeType
+ {
+ get
+ {
+ return timeIntegrationSchemeType;
+ }
+ }
+
+ ///
+ /// Gets the to use while executing the configured Hydra-Ring calculations.
+ ///
+ public HydraRingUncertaintiesType? UncertaintiesType
+ {
+ get
+ {
+ return uncertaintiesType;
+ }
+ }
+
+ ///
+ /// Adds a Hydra-Ring calculation to the .
+ ///
+ /// The container that holds all data for configuring the calculation.
+ public void AddHydraRingCalculation(HydraRingCalculationData hydraRingCalculationData)
+ {
+ hydraRingCalculations.Add(hydraRingCalculationData);
+ }
+
+ ///
+ /// Generates a database creation script that can be used to perform a Hydra-Ring calculation.
+ ///
+ /// The database creation script.
+ /// Thrown when one of the relevant input properties is not set.
+ public string GenerateDataBaseCreationScript()
+ {
+ var configurationDictionary = new Dictionary>();
+
+ InitializeHydraulicModelsConfiguration(configurationDictionary);
+ InitializeSectionsConfiguration(configurationDictionary);
+ InitializeDesignTablesConfiguration(configurationDictionary);
+ InitializeNumericsConfiguration(configurationDictionary);
+ InitializeAreasConfiguration(configurationDictionary);
+ InitializeProjectsConfiguration(configurationDictionary);
+
+ return GenerateDataBaseCreationScript(configurationDictionary);
+ }
+
+ private void InitializeHydraulicModelsConfiguration(Dictionary> configurationDictionary)
+ {
+ configurationDictionary["HydraulicModels"] = new List
+ {
+ new OrderedDictionary
+ {
+ {
+ "TimeIntegrationSchemeID", (int?) TimeIntegrationSchemeType
+ },
+ {
+ "UncertaintiesID", (int?) UncertaintiesType
+ },
+ {
+ "DataSetName", "WTI 2017" // Fixed: use the WTI 2017 set of station locations
+ }
+ }
+ };
+ }
+
+ private void InitializeSectionsConfiguration(Dictionary> configurationDictionary)
+ {
+ var orderedDictionaries = new List();
+
+ foreach (var hydraRingCalculation in hydraRingCalculations)
+ {
+ orderedDictionaries.Add(new OrderedDictionary
+ {
+ {
+ "SectionId", 999 // TODO: Dike section integration
+ },
+ {
+ "PresentationId", 1 // Fixed: no support for combination of multiple dike sections
+ },
+ {
+ "MainMechanismId", 1 // Fixed: no support for combination of multiple dike sections
+ },
+ {
+ "Name", "HydraRingLocation" // TODO: Dike section integration
+ },
+ {
+ "Description", "HydraRingLocation" // TODO: Dike section integration
+ },
+ {
+ "RingCoordinateBegin", null // TODO: Dike section integration
+ },
+ {
+ "RingCoordinateEnd", null // TODO: Dike section integration
+ },
+ {
+ "XCoordinate", null // TODO: Dike cross section integration
+ },
+ {
+ "YCoordinate", null // TODO: Dike cross section integration
+ },
+ {
+ "StationId1", hydraRingCalculation.HydraulicBoundaryLocationId
+ },
+ {
+ "StationId2", hydraRingCalculation.HydraulicBoundaryLocationId // Same as "StationId1": no support for coupling two stations
+ },
+ {
+ "Relative", 100.0 // Fixed: no support for coupling two stations
+ },
+ {
+ "Normal", null // TODO: Dike cross section integration
+ },
+ {
+ "Length", null // TODO: Dike section integration
+ }
+ });
+ }
+
+ configurationDictionary["Sections"] = orderedDictionaries;
+ }
+
+ private void InitializeDesignTablesConfiguration(Dictionary> configurationDictionary)
+ {
+ var orderedDictionaries = new List();
+
+ foreach (var hydraRingCalculation in hydraRingCalculations)
+ {
+ var failureMechanismDefaults = failureMechanismDefaultsProvider.GetFailureMechanismDefaults(hydraRingCalculation.FailureMechanismType);
+ var failureMechanismSettings = failureMechanismSettingsProvider.GetFailureMechanismSettings(hydraRingCalculation.FailureMechanismType);
+
+ orderedDictionaries.Add(new OrderedDictionary
+ {
+ {
+ "SectionId", 999 // TODO: Dike section integration
+ },
+ {
+ "MechanismId", failureMechanismDefaults.MechanismId
+ },
+ {
+ "LayerId", null // Fixed: no support for revetments
+ },
+ {
+ "AlternativeId", null // Fixed: no support for piping
+ },
+ {
+ "Method", failureMechanismDefaults.CalculationTypeId
+ },
+ {
+ "VariableId", failureMechanismDefaults.VariableId
+ },
+ {
+ "LoadVariableId", null // Fixed: not relevant
+ },
+ {
+ "TableMin", null // Fixed: no support for type 3 computations (see "Method")
+ },
+ {
+ "TableMax", null // Fixed: no support for type 3 computations (see "Method")
+ },
+ {
+ "TableStepSize", null // Fixed: no support for type 3 computations (see "Method")
+ },
+ {
+ "ValueMin", failureMechanismSettings.ValueMin
+ },
+ {
+ "ValueMax", failureMechanismSettings.ValueMax
+ },
+ {
+ "Beta", !double.IsNaN(hydraRingCalculation.Beta) ? (double?) hydraRingCalculation.Beta : null
+ }
+ });
+ }
+
+ configurationDictionary["DesignTables"] = orderedDictionaries;
+ }
+
+ private void InitializeNumericsConfiguration(Dictionary> configurationDictionary)
+ {
+ var orderDictionaries = new List();
+
+ foreach (var hydraRingCalculation in hydraRingCalculations)
+ {
+ var failureMechanismDefaults = failureMechanismDefaultsProvider.GetFailureMechanismDefaults(hydraRingCalculation.FailureMechanismType);
+
+ foreach (var subMechanimsId in failureMechanismDefaults.SubMechanismIds)
+ {
+ var subMechanismSettings = subMechanismSettingsProvider.GetSubMechanismSettings(hydraRingCalculation.FailureMechanismType, subMechanimsId);
+
+ orderDictionaries.Add(new OrderedDictionary
+ {
+ {
+ "SectionId", 999 // TODO: Dike section integration
+ },
+ {
+ "MechanismId", failureMechanismDefaults.MechanismId
+ },
+ {
+ "LayerId", null // Fixed: no support for revetments
+ },
+ {
+ "AlternativeId", null // Fixed: no support for piping
+ },
+ {
+ "SubMechanismId", subMechanimsId
+ },
+ {
+ "Method", subMechanismSettings.CalculationTechniqueId
+ },
+ {
+ "FormStartMethod", subMechanismSettings.FormStartMethod
+ },
+ {
+ "FormNumberOfIterations", subMechanismSettings.FormNumberOfIterations
+ },
+ {
+ "FormRelaxationFactor", subMechanismSettings.FormRelaxationFactor
+ },
+ {
+ "FormEpsBeta", subMechanismSettings.FormEpsBeta
+ },
+ {
+ "FormEpsHOH", subMechanismSettings.FormEpsHoh
+ },
+ {
+ "FormEpsZFunc", subMechanismSettings.FormEpsZFunc
+ },
+ {
+ "DsStartMethod", subMechanismSettings.DsStartMethod
+ },
+ {
+ "DsIterationmethod", 1 // Fixed: not relevant
+ },
+ {
+ "DsMinNumberOfIterations", subMechanismSettings.DsMinNumberOfIterations
+ },
+ {
+ "DsMaxNumberOfIterations", subMechanismSettings.DsMaxNumberOfIterations
+ },
+ {
+ "DsVarCoefficient", subMechanismSettings.DsVarCoefficient
+ },
+ {
+ "NiUMin", subMechanismSettings.NiUMin
+ },
+ {
+ "NiUMax", subMechanismSettings.NiUMax
+ },
+ {
+ "NiNumberSteps", subMechanismSettings.NiNumberSteps
+ }
+ });
+ }
+ }
+
+ configurationDictionary["Numerics"] = orderDictionaries;
+ }
+
+ private void InitializeAreasConfiguration(Dictionary> configurationDictionary)
+ {
+ configurationDictionary["Areas"] = new List
+ {
+ new OrderedDictionary
+ {
+ {
+ "aDefault", 1 // Fixed: not relevant
+ },
+ {
+ "bDefault", "1" // Fixed: not relevant
+ },
+ {
+ "cDefault", "Nederland" // Fixed: not relevant
+ }
+ }
+ };
+ }
+
+ private void InitializeProjectsConfiguration(Dictionary> configurationDictionary)
+ {
+ configurationDictionary["Projects"] = new List
+ {
+ new OrderedDictionary
+ {
+ {
+ "aDefault", 1 // Fixed: not relevant
+ },
+ {
+ "bDefault", "Sprint" // Fixed: not relevant
+ },
+ {
+ "cDefault", "Hydra-Ring Sprint" // Fixed: not relevant
+ }
+ }
+ };
+ }
+
+ private static string GenerateDataBaseCreationScript(Dictionary> configurationDictionary)
+ {
+ var lines = new List();
+
+ foreach (var tableName in configurationDictionary.Keys)
+ {
+ lines.Add("DELETE FROM [" + tableName + "];");
+
+ if (configurationDictionary[tableName].Count <= 0)
+ {
+ continue;
+ }
+
+ foreach (var orderedDictionary in configurationDictionary[tableName])
+ {
+ var valueStrings = new List();
+
+ foreach (var val in orderedDictionary.Values)
+ {
+ if (val == null)
+ {
+ valueStrings.Add("NULL");
+ continue;
+ }
+
+ if (val is string)
+ {
+ valueStrings.Add("'" + val + "'");
+ continue;
+ }
+
+ if (val is double)
+ {
+ valueStrings.Add(((double) val).ToString(CultureInfo.InvariantCulture));
+ continue;
+ }
+
+ valueStrings.Add(val.ToString());
+ }
+
+ var valuesString = string.Join(", ", valueStrings);
+
+ lines.Add("INSERT INTO [" + tableName + "] VALUES (" + valuesString + ");");
+ }
+
+ lines.Add("");
+ }
+
+ return string.Join(Environment.NewLine, lines);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Common/HydraRingVariable.cs
===================================================================
diff -u
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Common/HydraRingVariable.cs (revision 0)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Common/HydraRingVariable.cs (revision 56f86024f7598b3d5dd16940ddfa96c4fc72592d)
@@ -0,0 +1,167 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using Ringtoets.HydraRing.Calculation.Types;
+
+namespace Ringtoets.HydraRing.Calculation.Common
+{
+ ///
+ /// Container for Hydra-Ring variable related data.
+ ///
+ internal abstract class HydraRingVariable
+ {
+ private readonly int variableId;
+ private readonly HydraRingDistributionType distributionType;
+ private readonly double value;
+ private readonly HydraRingDeviationType deviationType;
+ private readonly double mean;
+ private readonly double variability;
+ private readonly double shift;
+ private readonly double correlationLength;
+
+ ///
+ /// Creates a new instance of the class.
+ ///
+ /// The Hydra-Ring id corresponding to the variable that is considered.
+ /// The probability distribution of the variable.
+ /// The value in case the variable is deterministic.
+ /// The deviation type in case the variable is random.
+ /// The mean value in case the variable is random.
+ /// The variability in case the variable is random.
+ /// The shift in case the variable is random.
+ /// The correlation length.
+ protected HydraRingVariable(int variableId, HydraRingDistributionType distributionType, double value, HydraRingDeviationType deviationType, double mean, double variability, double shift, double correlationLength)
+ {
+ this.variableId = variableId;
+ this.distributionType = distributionType;
+ this.value = value;
+ this.deviationType = deviationType;
+ this.mean = mean;
+ this.variability = variability;
+ this.shift = shift;
+ this.correlationLength = correlationLength;
+ }
+
+ ///
+ /// Gets the Hydra-Ring id corresponding to the variable that is considered.
+ ///
+ public int VariableId
+ {
+ get
+ {
+ return variableId;
+ }
+ }
+
+ ///
+ /// Gets the probability distribution of the variable.
+ ///
+ public HydraRingDistributionType DistributionType
+ {
+ get
+ {
+ return distributionType;
+ }
+ }
+
+ ///
+ /// Gets the value in case the variable is deterministic.
+ ///
+ ///
+ /// This property is only relevant when equals .
+ ///
+ public double Value
+ {
+ get
+ {
+ return value;
+ }
+ }
+
+ ///
+ /// Gets the deviation type in case the variable is random.
+ ///
+ ///
+ /// This property is only relevant when is not equal to .
+ ///
+ public HydraRingDeviationType DeviationType
+ {
+ get
+ {
+ return deviationType;
+ }
+ }
+
+ ///
+ /// Gets the mean value in case the variable is random.
+ ///
+ ///
+ /// This property is only relevant when is not equal to .
+ ///
+ public double Mean
+ {
+ get
+ {
+ return mean;
+ }
+ }
+
+ ///
+ /// Gets the variablity in case the variable is random.
+ ///
+ ///
+ /// The value represents a standard deviation in case the equals .
+ /// The value represents a variation coefficient in case the equals .
+ ///
+ public double Variability
+ {
+ get
+ {
+ return variability;
+ }
+ }
+
+ ///
+ /// Gets the shift in case the variable is random.
+ ///
+ ///
+ /// This property is only relevant when equals .
+ ///
+ public double Shift
+ {
+ get
+ {
+ return shift;
+ }
+ }
+
+ ///
+ /// Gets the correlation length.
+ ///
+ public double CorrelationLength
+ {
+ get
+ {
+ return correlationLength;
+ }
+ }
+ }
+}
Fisheye: Tag 56f86024f7598b3d5dd16940ddfa96c4fc72592d refers to a dead (removed) revision in file `Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/HydraRingCalculationData.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 56f86024f7598b3d5dd16940ddfa96c4fc72592d refers to a dead (removed) revision in file `Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/HydraRingVariable.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/HydraulicCalculationData.cs
===================================================================
diff -u -r9058670c6059b88f814daea133e3a5aed3117101 -r56f86024f7598b3d5dd16940ddfa96c4fc72592d
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/HydraulicCalculationData.cs (.../HydraulicCalculationData.cs) (revision 9058670c6059b88f814daea133e3a5aed3117101)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/HydraulicCalculationData.cs (.../HydraulicCalculationData.cs) (revision 56f86024f7598b3d5dd16940ddfa96c4fc72592d)
@@ -1,3 +1,5 @@
+using Ringtoets.HydraRing.Calculation.Common;
+
namespace Ringtoets.HydraRing.Calculation.Data
{
///
Fisheye: Tag 56f86024f7598b3d5dd16940ddfa96c4fc72592d refers to a dead (removed) revision in file `Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/HydraRingConfiguration.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Ringtoets.HydraRing.Calculation.csproj
===================================================================
diff -u -r02e4e3830d745db66a35986a2ffdfb9e484ad48a -r56f86024f7598b3d5dd16940ddfa96c4fc72592d
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Ringtoets.HydraRing.Calculation.csproj (.../Ringtoets.HydraRing.Calculation.csproj) (revision 02e4e3830d745db66a35986a2ffdfb9e484ad48a)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Ringtoets.HydraRing.Calculation.csproj (.../Ringtoets.HydraRing.Calculation.csproj) (revision 56f86024f7598b3d5dd16940ddfa96c4fc72592d)
@@ -40,17 +40,17 @@
Properties\GlobalAssembly.cs
-
+
-
+
-
+
Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Common/HydraRingConfigurationTest.cs
===================================================================
diff -u
--- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Common/HydraRingConfigurationTest.cs (revision 0)
+++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Common/HydraRingConfigurationTest.cs (revision 56f86024f7598b3d5dd16940ddfa96c4fc72592d)
@@ -0,0 +1,80 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using NUnit.Framework;
+using Ringtoets.HydraRing.Calculation.Common;
+using Ringtoets.HydraRing.Calculation.Data;
+using Ringtoets.HydraRing.Calculation.Types;
+
+namespace Ringtoets.HydraRing.Calculation.Test.Common
+{
+ [TestFixture]
+ public class HydraRingConfigurationTest
+ {
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Call
+ var hydraRingConfiguration = new HydraRingConfiguration(HydraRingTimeIntegrationSchemeType.NTI, HydraRingUncertaintiesType.Model);
+
+ // Assert
+ Assert.AreEqual(HydraRingTimeIntegrationSchemeType.NTI, hydraRingConfiguration.TimeIntegrationSchemeType);
+ Assert.AreEqual(HydraRingUncertaintiesType.Model, hydraRingConfiguration.UncertaintiesType);
+ }
+
+ [Test]
+ public void GenerateDataBaseCreationScript_NonDefaultHydraRingConfiguration_ReturnsExpectedCreationScript()
+ {
+ var hydraRingConfiguration = new HydraRingConfiguration(HydraRingTimeIntegrationSchemeType.NTI, HydraRingUncertaintiesType.Model);
+
+ hydraRingConfiguration.AddHydraRingCalculation(new QVariantCalculationData(700003, 1.1));
+ hydraRingConfiguration.AddHydraRingCalculation(new AssessmentLevelCalculationData(700004, 2.2));
+
+ var expectedCreationScript = "DELETE FROM [HydraulicModels];" + Environment.NewLine +
+ "INSERT INTO [HydraulicModels] VALUES (3, 2, 'WTI 2017');" + Environment.NewLine +
+ Environment.NewLine +
+ "DELETE FROM [Sections];" + Environment.NewLine +
+ "INSERT INTO [Sections] VALUES (999, 1, 1, 'HydraRingLocation', 'HydraRingLocation', NULL, NULL, NULL, NULL, 700003, 700003, 100, NULL, NULL);" + Environment.NewLine +
+ "INSERT INTO [Sections] VALUES (999, 1, 1, 'HydraRingLocation', 'HydraRingLocation', NULL, NULL, NULL, NULL, 700004, 700004, 100, NULL, NULL);" + Environment.NewLine +
+ Environment.NewLine +
+ "DELETE FROM [DesignTables];" + Environment.NewLine +
+ "INSERT INTO [DesignTables] VALUES (999, 3, NULL, NULL, 6, 114, NULL, NULL, NULL, NULL, 0, 50, 1.1);" + Environment.NewLine +
+ "INSERT INTO [DesignTables] VALUES (999, 1, NULL, NULL, 2, 26, NULL, NULL, NULL, NULL, 0, 50, 2.2);" + Environment.NewLine +
+ Environment.NewLine +
+ "DELETE FROM [Numerics];" + Environment.NewLine +
+ "INSERT INTO [Numerics] VALUES (999, 3, NULL, NULL, 3, 1, 4, 50, 0.15, 0.01, 0.01, 0.01, 2, 1, 10000, 20000, 0.1, -6, 6, 25);" + Environment.NewLine +
+ "INSERT INTO [Numerics] VALUES (999, 3, NULL, NULL, 4, 1, 4, 50, 0.15, 0.01, 0.01, 0.01, 2, 1, 10000, 20000, 0.1, -6, 6, 25);" + Environment.NewLine +
+ "INSERT INTO [Numerics] VALUES (999, 3, NULL, NULL, 5, 4, 4, 50, 0.15, 0.01, 0.01, 0.01, 2, 1, 10000, 20000, 0.1, -6, 6, 25);" + Environment.NewLine +
+ "INSERT INTO [Numerics] VALUES (999, 1, NULL, NULL, 1, 1, 4, 50, 0.15, 0.01, 0.01, 0.01, 2, 1, 10000, 20000, 0.1, -6, 6, 25);" + Environment.NewLine +
+ Environment.NewLine +
+ "DELETE FROM [Areas];" + Environment.NewLine +
+ "INSERT INTO [Areas] VALUES (1, '1', 'Nederland');" + Environment.NewLine +
+ Environment.NewLine +
+ "DELETE FROM [Projects];" + Environment.NewLine +
+ "INSERT INTO [Projects] VALUES (1, 'Sprint', 'Hydra-Ring Sprint');" + Environment.NewLine;
+
+ var creationScript = hydraRingConfiguration.GenerateDataBaseCreationScript();
+
+ Assert.AreEqual(expectedCreationScript, creationScript);
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 56f86024f7598b3d5dd16940ddfa96c4fc72592d refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/HydraRingConfigurationTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Ringtoets.HydraRing.Calculation.Test.csproj
===================================================================
diff -u -r02e4e3830d745db66a35986a2ffdfb9e484ad48a -r56f86024f7598b3d5dd16940ddfa96c4fc72592d
--- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Ringtoets.HydraRing.Calculation.Test.csproj (.../Ringtoets.HydraRing.Calculation.Test.csproj) (revision 02e4e3830d745db66a35986a2ffdfb9e484ad48a)
+++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Ringtoets.HydraRing.Calculation.Test.csproj (.../Ringtoets.HydraRing.Calculation.Test.csproj) (revision 56f86024f7598b3d5dd16940ddfa96c4fc72592d)
@@ -48,7 +48,7 @@
-
+