Index: Ringtoets/Common/src/Ringtoets.Common.IO/Structures/StructuresParameterRowsValidator.cs =================================================================== diff -u -rdc7692e5c549c25a0f59b41abe103f5c889353b3 -rfe34b0dd97d49bb1c426d0c5f9dd3b5d139cf1fe --- Ringtoets/Common/src/Ringtoets.Common.IO/Structures/StructuresParameterRowsValidator.cs (.../StructuresParameterRowsValidator.cs) (revision dc7692e5c549c25a0f59b41abe103f5c889353b3) +++ Ringtoets/Common/src/Ringtoets.Common.IO/Structures/StructuresParameterRowsValidator.cs (.../StructuresParameterRowsValidator.cs) (revision fe34b0dd97d49bb1c426d0c5f9dd3b5d139cf1fe) @@ -60,161 +60,161 @@ new Dictionary>> { { - "KW_HOOGTE1", StructureNormalOrientation + StructureFilesKeywords.HeightStructureParameterKeyword1, StructureNormalOrientation }, { - "KW_HOOGTE2", NormalDistributionRule + StructureFilesKeywords.HeightStructureParameterKeyword2, NormalDistributionRule }, { - "KW_HOOGTE3", LogNormalDistributionRule + StructureFilesKeywords.HeightStructureParameterKeyword3, LogNormalDistributionRule }, { - "KW_HOOGTE4", VariationCoefficientLogNormalDistributionRule + StructureFilesKeywords.HeightStructureParameterKeyword4, VariationCoefficientLogNormalDistributionRule }, { - "KW_HOOGTE5", VariationCoefficientNormalDistributionRule + StructureFilesKeywords.HeightStructureParameterKeyword5, VariationCoefficientNormalDistributionRule }, { - "KW_HOOGTE6", ProbabilityRule + StructureFilesKeywords.HeightStructureParameterKeyword6, ProbabilityRule }, { - "KW_HOOGTE7", VariationCoefficientLogNormalDistributionRule + StructureFilesKeywords.HeightStructureParameterKeyword7, VariationCoefficientLogNormalDistributionRule }, { - "KW_HOOGTE8", LogNormalDistributionRule + StructureFilesKeywords.HeightStructureParameterKeyword8, LogNormalDistributionRule } }; private static readonly Dictionary>> closingStructuresRules = new Dictionary>> { { - "KW_BETSLUIT1", VariationCoefficientLogNormalDistributionRule + StructureFilesKeywords.ClosingStructureParameterKeyword1, VariationCoefficientLogNormalDistributionRule }, { - "KW_BETSLUIT2", LogNormalDistributionRule + StructureFilesKeywords.ClosingStructureParameterKeyword2, LogNormalDistributionRule }, { - "KW_BETSLUIT3", StructureNormalOrientation + StructureFilesKeywords.ClosingStructureParameterKeyword3, StructureNormalOrientation }, { - "KW_BETSLUIT4", VariationCoefficientNormalDistributionRule + StructureFilesKeywords.ClosingStructureParameterKeyword4, VariationCoefficientNormalDistributionRule }, { - "KW_BETSLUIT5", NormalDistributionRule + StructureFilesKeywords.ClosingStructureParameterKeyword5, NormalDistributionRule }, { - "KW_BETSLUIT6", NormalDistributionRule + StructureFilesKeywords.ClosingStructureParameterKeyword6, NormalDistributionRule }, { - "KW_BETSLUIT7", NormalDistributionRule + StructureFilesKeywords.ClosingStructureParameterKeyword7, NormalDistributionRule }, { - "KW_BETSLUIT8", LogNormalDistributionRule + StructureFilesKeywords.ClosingStructureParameterKeyword8, LogNormalDistributionRule }, { - "KW_BETSLUIT9", VariationCoefficientLogNormalDistributionRule + StructureFilesKeywords.ClosingStructureParameterKeyword9, VariationCoefficientLogNormalDistributionRule }, { - "KW_BETSLUIT10", LogNormalDistributionRule + StructureFilesKeywords.ClosingStructureParameterKeyword10, LogNormalDistributionRule }, { - "KW_BETSLUIT11", ProbabilityRule + StructureFilesKeywords.ClosingStructureParameterKeyword11, ProbabilityRule }, { - "KW_BETSLUIT12", ProbabilityRule + StructureFilesKeywords.ClosingStructureParameterKeyword12, ProbabilityRule }, { - "KW_BETSLUIT13", IdenticalApertures + StructureFilesKeywords.ClosingStructureParameterKeyword13, IdenticalApertures }, { - "KW_BETSLUIT14", ProbabilityRule + StructureFilesKeywords.ClosingStructureParameterKeyword14, ProbabilityRule }, { - "KW_BETSLUIT15", ClosingStructureInflowModelRule + StructureFilesKeywords.ClosingStructureParameterKeyword15, ClosingStructureInflowModelRule } }; private static readonly Dictionary>> stabilityPointStructuresRules = new Dictionary>> { { - "KW_STERSTAB1", StructureNormalOrientation + StructureFilesKeywords.StabilityPointStructureParameterKeyword1, StructureNormalOrientation }, { - "KW_STERSTAB2", VariationCoefficientLogNormalDistributionRule + StructureFilesKeywords.StabilityPointStructureParameterKeyword2, VariationCoefficientLogNormalDistributionRule }, { - "KW_STERSTAB3", LogNormalDistributionRule + StructureFilesKeywords.StabilityPointStructureParameterKeyword3, LogNormalDistributionRule }, { - "KW_STERSTAB4", VariationCoefficientNormalDistributionRule + StructureFilesKeywords.StabilityPointStructureParameterKeyword4, VariationCoefficientNormalDistributionRule }, { - "KW_STERSTAB5", NormalDistributionRule + StructureFilesKeywords.StabilityPointStructureParameterKeyword5, NormalDistributionRule }, { - "KW_STERSTAB6", NormalDistributionRule + StructureFilesKeywords.StabilityPointStructureParameterKeyword6, NormalDistributionRule }, { - "KW_STERSTAB7", VariationCoefficientLogNormalDistributionRule + StructureFilesKeywords.StabilityPointStructureParameterKeyword7, VariationCoefficientLogNormalDistributionRule }, { - "KW_STERSTAB8", LogNormalDistributionRule + StructureFilesKeywords.StabilityPointStructureParameterKeyword8, LogNormalDistributionRule }, { - "KW_STERSTAB9", VariationCoefficientLogNormalDistributionRule + StructureFilesKeywords.StabilityPointStructureParameterKeyword9, VariationCoefficientLogNormalDistributionRule }, { - "KW_STERSTAB10", VariationCoefficientLogNormalDistributionRule + StructureFilesKeywords.StabilityPointStructureParameterKeyword10, VariationCoefficientLogNormalDistributionRule }, { - "KW_STERSTAB11", NormalDistributionRule + StructureFilesKeywords.StabilityPointStructureParameterKeyword11, NormalDistributionRule }, { - "KW_STERSTAB12", NormalDistributionRule + StructureFilesKeywords.StabilityPointStructureParameterKeyword12, NormalDistributionRule }, { - "KW_STERSTAB13", DoubleRule + StructureFilesKeywords.StabilityPointStructureParameterKeyword13, DoubleRule }, { - "KW_STERSTAB14", NormalDistributionRule + StructureFilesKeywords.StabilityPointStructureParameterKeyword14, NormalDistributionRule }, { - "KW_STERSTAB15", PositiveDoubleRule + StructureFilesKeywords.StabilityPointStructureParameterKeyword15, PositiveDoubleRule }, { - "KW_STERSTAB16", ProbabilityRule + StructureFilesKeywords.StabilityPointStructureParameterKeyword16, ProbabilityRule }, { - "KW_STERSTAB17", PositiveDoubleRule + StructureFilesKeywords.StabilityPointStructureParameterKeyword17, PositiveDoubleRule }, { - "KW_STERSTAB18", VariationCoefficientNormalDistributionRule + StructureFilesKeywords.StabilityPointStructureParameterKeyword18, VariationCoefficientNormalDistributionRule }, { - "KW_STERSTAB19", VariationCoefficientNormalDistributionRule + StructureFilesKeywords.StabilityPointStructureParameterKeyword19, VariationCoefficientNormalDistributionRule }, { - "KW_STERSTAB20", PositiveDoubleRule + StructureFilesKeywords.StabilityPointStructureParameterKeyword20, PositiveDoubleRule }, { - "KW_STERSTAB21", PositiveDoubleRule + StructureFilesKeywords.StabilityPointStructureParameterKeyword21, PositiveDoubleRule }, { - "KW_STERSTAB22", NormalDistributionRule + StructureFilesKeywords.StabilityPointStructureParameterKeyword22, NormalDistributionRule }, { - "KW_STERSTAB23", VariationCoefficientLogNormalDistributionRule + StructureFilesKeywords.StabilityPointStructureParameterKeyword23, VariationCoefficientLogNormalDistributionRule }, { - "KW_STERSTAB24", VariationCoefficientLogNormalDistributionRule + StructureFilesKeywords.StabilityPointStructureParameterKeyword24, VariationCoefficientLogNormalDistributionRule }, { - "KW_STERSTAB25", LogNormalDistributionRule + StructureFilesKeywords.StabilityPointStructureParameterKeyword25, LogNormalDistributionRule }, { - "KW_STERSTAB26", StabilityPointStructureInflowModelRule + StructureFilesKeywords.StabilityPointStructureParameterKeyword26, StabilityPointStructureInflowModelRule }, }; Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/Structures/StructuresParameterRowsValidatorTest.cs =================================================================== diff -u -rdc7692e5c549c25a0f59b41abe103f5c889353b3 -rfe34b0dd97d49bb1c426d0c5f9dd3b5d139cf1fe --- Ringtoets/Common/test/Ringtoets.Common.IO.Test/Structures/StructuresParameterRowsValidatorTest.cs (.../StructuresParameterRowsValidatorTest.cs) (revision dc7692e5c549c25a0f59b41abe103f5c889353b3) +++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/Structures/StructuresParameterRowsValidatorTest.cs (.../StructuresParameterRowsValidatorTest.cs) (revision fe34b0dd97d49bb1c426d0c5f9dd3b5d139cf1fe) @@ -366,5 +366,312 @@ }; CollectionAssert.AreEqual(expectedErrorMessages, validationResult.ErrorMessages); } + + [Test] + public void ValidateStabilityPointStructuresParameters_StructureParameterRowsNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => StructuresParameterRowsValidator.ValidateStabilityPointStructuresParameters(null); + + // Assert + string paramName = Assert.Throws(call).ParamName; + Assert.AreEqual("structureParameterRows", paramName); + } + + [Test] + public void ValidateStabilityPointStructuresParameters_ParameterIdsMissingOrDuplicated_ExpectedValues() + { + // Setup + var structuresParameterRow = new StructuresParameterRow + { + ParameterId = "KW_STERSTAB1", + NumericalValue = 180.0 + }; + + List structureParameterRows = new List + { + structuresParameterRow, + structuresParameterRow + }; + + // Call + ValidationResult validationResult = StructuresParameterRowsValidator.ValidateStabilityPointStructuresParameters(structureParameterRows); + + // Assert + Assert.IsFalse(validationResult.IsValid); + List expectedErrorMessages = new List + { + "Parameter 'KW_STERSTAB1' komt meermaals voor.", + "Parameter 'KW_STERSTAB2' ontbreekt.", + "Parameter 'KW_STERSTAB3' ontbreekt.", + "Parameter 'KW_STERSTAB4' ontbreekt.", + "Parameter 'KW_STERSTAB5' ontbreekt.", + "Parameter 'KW_STERSTAB6' ontbreekt.", + "Parameter 'KW_STERSTAB7' ontbreekt.", + "Parameter 'KW_STERSTAB8' ontbreekt.", + "Parameter 'KW_STERSTAB9' ontbreekt.", + "Parameter 'KW_STERSTAB10' ontbreekt.", + "Parameter 'KW_STERSTAB11' ontbreekt.", + "Parameter 'KW_STERSTAB12' ontbreekt.", + "Parameter 'KW_STERSTAB13' ontbreekt.", + "Parameter 'KW_STERSTAB14' ontbreekt.", + "Parameter 'KW_STERSTAB15' ontbreekt.", + "Parameter 'KW_STERSTAB16' ontbreekt.", + "Parameter 'KW_STERSTAB17' ontbreekt.", + "Parameter 'KW_STERSTAB18' ontbreekt.", + "Parameter 'KW_STERSTAB19' ontbreekt.", + "Parameter 'KW_STERSTAB20' ontbreekt.", + "Parameter 'KW_STERSTAB21' ontbreekt.", + "Parameter 'KW_STERSTAB22' ontbreekt.", + "Parameter 'KW_STERSTAB23' ontbreekt.", + "Parameter 'KW_STERSTAB24' ontbreekt.", + "Parameter 'KW_STERSTAB25' ontbreekt.", + "Parameter 'KW_STERSTAB26' ontbreekt." + }; + CollectionAssert.AreEqual(expectedErrorMessages, validationResult.ErrorMessages); + } + + [Test] + public void ValidateStabilityPointStructuresParameters_ParametersAllInvalid_ExpectedValues() + { + // Setup + List structureParameterRows = new List + { + new StructuresParameterRow + { + ParameterId = "KW_STERSTAB1", + NumericalValue = double.NaN, + LineNumber = 1 + }, + new StructuresParameterRow + { + ParameterId = "KW_STERSTAB2", + NumericalValue = 1e-5, + VarianceValue = 1.0, + VarianceType = VarianceType.StandardDeviation, + LineNumber = 2 + }, + new StructuresParameterRow + { + ParameterId = "KW_STERSTAB3", + NumericalValue = double.NaN, + VarianceValue = double.NaN, + LineNumber = 3 + }, + new StructuresParameterRow + { + ParameterId = "KW_STERSTAB4", + NumericalValue = 0, + VarianceValue = 10.0, + VarianceType = VarianceType.CoefficientOfVariation, + LineNumber = 4 + }, + new StructuresParameterRow + { + ParameterId = "KW_STERSTAB5", + NumericalValue = double.PositiveInfinity, + VarianceValue = 10.0, + VarianceType = VarianceType.NotSpecified, + LineNumber = 5 + }, + new StructuresParameterRow + { + ParameterId = "KW_STERSTAB6", + NumericalValue = double.PositiveInfinity, + VarianceValue = 10.0, + VarianceType = VarianceType.NotSpecified, + LineNumber = 6 + }, + new StructuresParameterRow + { + ParameterId = "KW_STERSTAB7", + NumericalValue = 1e-5, + VarianceValue = 1.0, + VarianceType = VarianceType.StandardDeviation, + LineNumber = 7 + }, + new StructuresParameterRow + { + ParameterId = "KW_STERSTAB8", + NumericalValue = double.NaN, + VarianceValue = double.NaN, + LineNumber = 8 + }, + new StructuresParameterRow + { + ParameterId = "KW_STERSTAB9", + NumericalValue = 1e-5, + VarianceValue = 1.0, + VarianceType = VarianceType.StandardDeviation, + LineNumber = 9 + }, + new StructuresParameterRow + { + ParameterId = "KW_STERSTAB10", + NumericalValue = 1e-5, + VarianceValue = 1.0, + VarianceType = VarianceType.StandardDeviation, + LineNumber = 10 + }, + new StructuresParameterRow + { + ParameterId = "KW_STERSTAB11", + NumericalValue = double.PositiveInfinity, + VarianceValue = 10.0, + VarianceType = VarianceType.NotSpecified, + LineNumber = 11 + }, + new StructuresParameterRow + { + ParameterId = "KW_STERSTAB12", + NumericalValue = double.PositiveInfinity, + VarianceValue = 10.0, + VarianceType = VarianceType.NotSpecified, + LineNumber = 12 + }, + new StructuresParameterRow + { + ParameterId = "KW_STERSTAB13", + NumericalValue = double.NaN, + LineNumber = 13 + }, + new StructuresParameterRow + { + ParameterId = "KW_STERSTAB14", + NumericalValue = double.PositiveInfinity, + VarianceValue = 10.0, + VarianceType = VarianceType.NotSpecified, + LineNumber = 14 + }, + new StructuresParameterRow + { + ParameterId = "KW_STERSTAB15", + NumericalValue = -1.0, + LineNumber = 15 + }, + new StructuresParameterRow + { + ParameterId = "KW_STERSTAB16", + NumericalValue = double.NegativeInfinity, + LineNumber = 16 + }, + new StructuresParameterRow + { + ParameterId = "KW_STERSTAB17", + NumericalValue = -1.0, + LineNumber = 17 + }, + new StructuresParameterRow + { + ParameterId = "KW_STERSTAB18", + NumericalValue = 0, + VarianceValue = 10.0, + VarianceType = VarianceType.CoefficientOfVariation, + LineNumber = 18 + }, + new StructuresParameterRow + { + ParameterId = "KW_STERSTAB19", + NumericalValue = 0, + VarianceValue = 10.0, + VarianceType = VarianceType.CoefficientOfVariation, + LineNumber = 19 + }, + new StructuresParameterRow + { + ParameterId = "KW_STERSTAB20", + NumericalValue = -1.0, + LineNumber = 20 + }, + new StructuresParameterRow + { + ParameterId = "KW_STERSTAB21", + NumericalValue = -1.0, + LineNumber = 21 + }, + new StructuresParameterRow + { + ParameterId = "KW_STERSTAB22", + NumericalValue = double.PositiveInfinity, + VarianceValue = 10.0, + VarianceType = VarianceType.NotSpecified, + LineNumber = 22 + }, + new StructuresParameterRow + { + ParameterId = "KW_STERSTAB23", + NumericalValue = 1e-5, + VarianceValue = 1.0, + VarianceType = VarianceType.StandardDeviation, + LineNumber = 23 + }, + new StructuresParameterRow + { + ParameterId = "KW_STERSTAB24", + NumericalValue = 1e-5, + VarianceValue = 1.0, + VarianceType = VarianceType.StandardDeviation, + LineNumber = 24 + }, + new StructuresParameterRow + { + ParameterId = "KW_STERSTAB25", + NumericalValue = double.NaN, + VarianceValue = double.NaN, + LineNumber = 25 + }, + new StructuresParameterRow + { + ParameterId = "KW_STERSTAB26", + AlphanumericValue = "oei", + LineNumber = 26 + } + }; + + // Call + ValidationResult validationResult = StructuresParameterRowsValidator.ValidateStabilityPointStructuresParameters(structureParameterRows); + + // Assert + Assert.IsFalse(validationResult.IsValid); + List expectedErrorMessages = new List + { + "De waarde op regel 1, kolom 'NumeriekeWaarde' valt buiten het bereik [0, 360].", + "Voor een betrouwbare conversie tussen standaard deviatie en variatiecoëfficiënt mag de gemiddelde waarde (op regel 2, kolom numeriekewaarde) niet te dicht op 0 zijn.", + "De waarde op regel 3, kolom 'NumeriekeWaarde' is ongeldig.", + "De waarde op regel 3, kolom 'Boolean' is ongeldig.", + "De waarde op regel 3, kolom 'Standarddeviatie.variance' is ongeldig.", + "De waarde op regel 5, kolom 'NumeriekeWaarde' is ongeldig.", + "De waarde op regel 5, kolom 'Boolean' is ongeldig.", + "De waarde op regel 6, kolom 'NumeriekeWaarde' is ongeldig.", + "De waarde op regel 6, kolom 'Boolean' is ongeldig.", + "Voor een betrouwbare conversie tussen standaard deviatie en variatiecoëfficiënt mag de gemiddelde waarde (op regel 7, kolom numeriekewaarde) niet te dicht op 0 zijn.", + "De waarde op regel 8, kolom 'NumeriekeWaarde' is ongeldig.", + "De waarde op regel 8, kolom 'Boolean' is ongeldig.", + "De waarde op regel 8, kolom 'Standarddeviatie.variance' is ongeldig.", + "Voor een betrouwbare conversie tussen standaard deviatie en variatiecoëfficiënt mag de gemiddelde waarde (op regel 9, kolom numeriekewaarde) niet te dicht op 0 zijn.", + "Voor een betrouwbare conversie tussen standaard deviatie en variatiecoëfficiënt mag de gemiddelde waarde (op regel 10, kolom numeriekewaarde) niet te dicht op 0 zijn.", + "De waarde op regel 11, kolom 'NumeriekeWaarde' is ongeldig.", + "De waarde op regel 11, kolom 'Boolean' is ongeldig.", + "De waarde op regel 12, kolom 'NumeriekeWaarde' is ongeldig.", + "De waarde op regel 12, kolom 'Boolean' is ongeldig.", + "De waarde op regel 13, kolom 'NumeriekeWaarde' valt buiten het bereik (0, 1].", + "De waarde op regel 14, kolom 'NumeriekeWaarde' is ongeldig.", + "De waarde op regel 14, kolom 'Boolean' is ongeldig.", + "De waarde op regel 15, kolom 'NumeriekeWaarde' valt buiten het bereik (0, 1].", + "De waarde op regel 16, kolom 'NumeriekeWaarde' valt buiten het bereik (0, 1].", + "De waarde op regel 17, kolom 'NumeriekeWaarde' valt buiten het bereik (0, 1].", + "De waarde op regel 20, kolom 'NumeriekeWaarde' valt buiten het bereik (0, 1].", + "De waarde op regel 21, kolom 'NumeriekeWaarde' valt buiten het bereik (0, 1].", + "De waarde op regel 22, kolom 'NumeriekeWaarde' is ongeldig.", + "De waarde op regel 22, kolom 'Boolean' is ongeldig.", + "Voor een betrouwbare conversie tussen standaard deviatie en variatiecoëfficiënt mag de gemiddelde waarde (op regel 23, kolom numeriekewaarde) niet te dicht op 0 zijn.", + "Voor een betrouwbare conversie tussen standaard deviatie en variatiecoëfficiënt mag de gemiddelde waarde (op regel 24, kolom numeriekewaarde) niet te dicht op 0 zijn.", + "De waarde op regel 25, kolom 'NumeriekeWaarde' is ongeldig.", + "De waarde op regel 25, kolom 'Boolean' is ongeldig.", + "De waarde op regel 25, kolom 'Standarddeviatie.variance' is ongeldig.", + "De waarde op regel 26, kolom 'AlphanumeriekeWaarde' is ongeldig." + }; + CollectionAssert.AreEqual(expectedErrorMessages, validationResult.ErrorMessages); + } } } \ No newline at end of file Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.IO.Test/packages.config =================================================================== diff -u -rb70abd70f1cd326d1a753c5879a065149ac2ae84 -rfe34b0dd97d49bb1c426d0c5f9dd3b5d139cf1fe --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.IO.Test/packages.config (.../packages.config) (revision b70abd70f1cd326d1a753c5879a065149ac2ae84) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.IO.Test/packages.config (.../packages.config) (revision fe34b0dd97d49bb1c426d0c5f9dd3b5d139cf1fe) @@ -1,4 +1,5 @@ -