Index: Core/Common/src/Core.Common.Base/Properties/Resources.Designer.cs =================================================================== diff -u -r12a35732d53e73c149035a212f96d2a0e9604cff -r73aa6b5e849110e5c7cb584cce2aeb36698e7eee --- Core/Common/src/Core.Common.Base/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 12a35732d53e73c149035a212f96d2a0e9604cff) +++ Core/Common/src/Core.Common.Base/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 73aa6b5e849110e5c7cb584cce2aeb36698e7eee) @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.18444 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. Index: Ringtoets/Piping/src/Ringtoets.Piping.Service/PipingCalculationService.cs =================================================================== diff -u -r49d90fb457184cd520ada77ee07774405985abd5 -r73aa6b5e849110e5c7cb584cce2aeb36698e7eee --- Ringtoets/Piping/src/Ringtoets.Piping.Service/PipingCalculationService.cs (.../PipingCalculationService.cs) (revision 49d90fb457184cd520ada77ee07774405985abd5) +++ Ringtoets/Piping/src/Ringtoets.Piping.Service/PipingCalculationService.cs (.../PipingCalculationService.cs) (revision 73aa6b5e849110e5c7cb584cce2aeb36698e7eee) @@ -66,7 +66,7 @@ /// /// Performs a piping calculation based on the supplied and sets - /// to the if the calculation was successful. Error and status information is logged during + /// based on the result if the calculation was successful. Error and status information is logged during /// the execution of the operation. /// /// The to base the input for the calculation upon. @@ -100,16 +100,68 @@ { List validationResult = new List(); - if (double.IsNaN(inputParameters.ThicknessAquiferLayer.Mean)) + var isHydraulicBoundaryLocationMissing = inputParameters.HydraulicBoundaryLocation == null; + var isSoilProfileMissing = inputParameters.StochasticSoilProfile == null; + var isSurfaceLineMissing = inputParameters.SurfaceLine == null; + var isExitPointLMissing = double.IsNaN(inputParameters.ExitPointL); + var isEntryPointLMissing = double.IsNaN(inputParameters.EntryPointL); + var isExitPointLBeyondEntryPointL = inputParameters.ExitPointL > inputParameters.EntryPointL; + + if (isHydraulicBoundaryLocationMissing) { - validationResult.Add(Resources.PipingCalculationService_ValidateInput_Cannot_determine_thickness_aquifer_layer); + validationResult.Add(Resources.PipingCalculationService_ValidateInput_No_HydraulicBoundaryLocation_selected); } - if (double.IsNaN(inputParameters.ThicknessCoverageLayer.Mean)) + if (isSurfaceLineMissing) { - validationResult.Add(Resources.PipingCalculationService_ValidateInput_Cannot_determine_thickness_coverage_layer); + validationResult.Add(Resources.PipingCalculationService_ValidateInput_No_SurfaceLine_selected); } + if (isSoilProfileMissing) + { + validationResult.Add(Resources.PipingCalculationService_ValidateInput_No_StochasticSoilProfile_selected); + } + + if (isEntryPointLMissing) + { + validationResult.Add(Resources.PipingCalculationService_ValidateInput_No_value_for_EntryPointL); + } + + if (isExitPointLMissing) + { + validationResult.Add(Resources.PipingCalculationService_ValidateInput_No_value_for_ExitPointL); + } + + if (!isEntryPointLMissing && !isExitPointLMissing && !isExitPointLBeyondEntryPointL) + { + validationResult.Add(Resources.PipingCalculationService_ValidateInput_EntryPointL_greater_or_equal_to_ExitPointL); + } + + if (!isHydraulicBoundaryLocationMissing) + { + if (double.IsNaN(inputParameters.AssessmentLevel)) + { + validationResult.Add(Resources.PipingCalculationService_ValidateInput_Cannot_determine_AssessmentLevel); + } + if (double.IsNaN(inputParameters.PiezometricHeadExit)) + { + validationResult.Add(Resources.PipingCalculationService_ValidateInput_Cannot_determine_PiezometricHeadExit); + } + } + + if (!isSurfaceLineMissing && !isSoilProfileMissing && !isExitPointLMissing) + { + if (double.IsNaN(inputParameters.ThicknessAquiferLayer.Mean)) + { + validationResult.Add(Resources.PipingCalculationService_ValidateInput_Cannot_determine_thickness_aquifer_layer); + } + + if (double.IsNaN(inputParameters.ThicknessCoverageLayer.Mean)) + { + validationResult.Add(Resources.PipingCalculationService_ValidateInput_Cannot_determine_thickness_coverage_layer); + } + } + return validationResult; } @@ -139,8 +191,7 @@ inputParameters.BeddingAngle, inputParameters.ExitPointL, inputParameters.SurfaceLine, - inputParameters.StochasticSoilProfile.SoilProfile - ); + inputParameters.StochasticSoilProfile.SoilProfile); } } } \ No newline at end of file Index: Ringtoets/Piping/src/Ringtoets.Piping.Service/Properties/Resources.Designer.cs =================================================================== diff -u -r845bead95b248fd299e02c02e9ae0892eebc6335 -r73aa6b5e849110e5c7cb584cce2aeb36698e7eee --- Ringtoets/Piping/src/Ringtoets.Piping.Service/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 845bead95b248fd299e02c02e9ae0892eebc6335) +++ Ringtoets/Piping/src/Ringtoets.Piping.Service/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 73aa6b5e849110e5c7cb584cce2aeb36698e7eee) @@ -79,6 +79,24 @@ } /// + /// Looks up a localized string similar to Kan het toetspeil niet afleiden op basis van de invoer.. + /// + internal static string PipingCalculationService_ValidateInput_Cannot_determine_AssessmentLevel { + get { + return ResourceManager.GetString("PipingCalculationService_ValidateInput_Cannot_determine_AssessmentLevel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Kan de stijghoogte bij het uittredepunt niet afleiden op basis van de invoer.. + /// + internal static string PipingCalculationService_ValidateInput_Cannot_determine_PiezometricHeadExit { + get { + return ResourceManager.GetString("PipingCalculationService_ValidateInput_Cannot_determine_PiezometricHeadExit", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Kan de dikte van het watervoerend pakket niet afleiden op basis van de invoer.. /// internal static string PipingCalculationService_ValidateInput_Cannot_determine_thickness_aquifer_layer { @@ -97,6 +115,61 @@ } /// + /// Looks up a localized string similar to Het uittredepunt ligt niet voorbij het intredepunt.. + /// + internal static string PipingCalculationService_ValidateInput_EntryPointL_greater_or_equal_to_ExitPointL { + get { + return ResourceManager.GetString("PipingCalculationService_ValidateInput_EntryPointL_greater_or_equal_to_ExitPointL" + + "", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Er is geen hydraulische randvoorwaarden locatie geselecteerd.. + /// + internal static string PipingCalculationService_ValidateInput_No_HydraulicBoundaryLocation_selected { + get { + return ResourceManager.GetString("PipingCalculationService_ValidateInput_No_HydraulicBoundaryLocation_selected", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Er is geen stochastisch ondergrondprofiel geselecteerd.. + /// + internal static string PipingCalculationService_ValidateInput_No_StochasticSoilProfile_selected { + get { + return ResourceManager.GetString("PipingCalculationService_ValidateInput_No_StochasticSoilProfile_selected", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Er is geen profielschematisatie geselecteerd.. + /// + internal static string PipingCalculationService_ValidateInput_No_SurfaceLine_selected { + get { + return ResourceManager.GetString("PipingCalculationService_ValidateInput_No_SurfaceLine_selected", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Er is geen waarde voor het intredepunt opgegeven.. + /// + internal static string PipingCalculationService_ValidateInput_No_value_for_EntryPointL { + get { + return ResourceManager.GetString("PipingCalculationService_ValidateInput_No_value_for_EntryPointL", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Er is geen waarde voor het uittredepunt opgegeven.. + /// + internal static string PipingCalculationService_ValidateInput_No_value_for_ExitPointL { + get { + return ResourceManager.GetString("PipingCalculationService_ValidateInput_No_value_for_ExitPointL", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Veiligheidsfactor voor piping kan niet worden berekend.. /// internal static string PipingSemiProbabilisticCalculationService_ValidateOutputOnCalculation_Factor_of_safety_cannot_be_calculated { Index: Ringtoets/Piping/src/Ringtoets.Piping.Service/Properties/Resources.resx =================================================================== diff -u -r845bead95b248fd299e02c02e9ae0892eebc6335 -r73aa6b5e849110e5c7cb584cce2aeb36698e7eee --- Ringtoets/Piping/src/Ringtoets.Piping.Service/Properties/Resources.resx (.../Resources.resx) (revision 845bead95b248fd299e02c02e9ae0892eebc6335) +++ Ringtoets/Piping/src/Ringtoets.Piping.Service/Properties/Resources.resx (.../Resources.resx) (revision 73aa6b5e849110e5c7cb584cce2aeb36698e7eee) @@ -132,4 +132,28 @@ Veiligheidsfactor voor piping kan niet worden berekend. + + Er is geen stochastisch ondergrondprofiel geselecteerd. + + + Er is geen profielschematisatie geselecteerd. + + + Er is geen hydraulische randvoorwaarden locatie geselecteerd. + + + Kan de stijghoogte bij het uittredepunt niet afleiden op basis van de invoer. + + + Kan het toetspeil niet afleiden op basis van de invoer. + + + Er is geen waarde voor het intredepunt opgegeven. + + + Er is geen waarde voor het uittredepunt opgegeven. + + + Het uittredepunt ligt niet voorbij het intredepunt. + \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Service.Test/PipingCalculationServiceTest.cs =================================================================== diff -u -r14de3deecd2cff7f6abe41ed6dc5dc016c4c81e0 -r73aa6b5e849110e5c7cb584cce2aeb36698e7eee --- Ringtoets/Piping/test/Ringtoets.Piping.Service.Test/PipingCalculationServiceTest.cs (.../PipingCalculationServiceTest.cs) (revision 14de3deecd2cff7f6abe41ed6dc5dc016c4c81e0) +++ Ringtoets/Piping/test/Ringtoets.Piping.Service.Test/PipingCalculationServiceTest.cs (.../PipingCalculationServiceTest.cs) (revision 73aa6b5e849110e5c7cb584cce2aeb36698e7eee) @@ -89,8 +89,228 @@ TestHelper.AssertLogMessages(call, messages => { var msgs = messages.ToArray(); + Assert.AreEqual(7, msgs.Length); + StringAssert.StartsWith(String.Format("Validatie van '{0}' gestart om: ", name), msgs.First()); + StringAssert.StartsWith("Validatie mislukt: Er is geen hydraulische randvoorwaarden locatie geselecteerd.", msgs[1]); + StringAssert.StartsWith("Validatie mislukt: Er is geen profielschematisatie geselecteerd.", msgs[2]); + StringAssert.StartsWith("Validatie mislukt: Er is geen stochastisch ondergrondprofiel geselecteerd.", msgs[3]); + StringAssert.StartsWith("Validatie mislukt: Er is geen waarde voor het intredepunt opgegeven.", msgs[4]); + StringAssert.StartsWith("Validatie mislukt: Er is geen waarde voor het uittredepunt opgegeven.", msgs[5]); + StringAssert.StartsWith(String.Format("Validatie van '{0}' beëindigd om: ", name), msgs.Last()); + }); + Assert.IsFalse(isValid); + } + + [Test] + public void Validate_CalculationWithoutHydraulicBoundaryLocation_LogsErrorAndReturnsFalse() + { + // Setup + const string name = ""; + + PipingCalculation calculation = PipingCalculationFactory.CreateCalculationWithValidInput(); + calculation.InputParameters.HydraulicBoundaryLocation = null; + calculation.Name = name; + + // Call + bool isValid = false; + Action call = () => isValid = PipingCalculationService.Validate(calculation); + + // Assert + TestHelper.AssertLogMessages(call, messages => + { + var msgs = messages.ToArray(); + Assert.AreEqual(3, msgs.Length); + StringAssert.StartsWith(String.Format("Validatie van '{0}' gestart om: ", name), msgs.First()); + StringAssert.StartsWith("Validatie mislukt: Er is geen hydraulische randvoorwaarden locatie geselecteerd.", msgs[1]); + StringAssert.StartsWith(String.Format("Validatie van '{0}' beëindigd om: ", name), msgs.Last()); + }); + Assert.IsFalse(isValid); + } + + [Test] + public void Validate_CalculationWithHydraulicBoundaryLocationNotCalculated_LogsErrorAndReturnsFalse() + { + // Setup + const string name = ""; + + PipingCalculation calculation = PipingCalculationFactory.CreateCalculationWithValidInput(); + calculation.InputParameters.HydraulicBoundaryLocation.DesignWaterLevel = double.NaN; + calculation.Name = name; + + // Call + bool isValid = false; + Action call = () => isValid = PipingCalculationService.Validate(calculation); + + // Assert + TestHelper.AssertLogMessages(call, messages => + { + var msgs = messages.ToArray(); Assert.AreEqual(4, msgs.Length); StringAssert.StartsWith(String.Format("Validatie van '{0}' gestart om: ", name), msgs.First()); + StringAssert.StartsWith("Validatie mislukt: Kan het toetspeil niet afleiden op basis van de invoer.", msgs[1]); + StringAssert.StartsWith("Validatie mislukt: Kan de stijghoogte bij het uittredepunt niet afleiden op basis van de invoer.", msgs[2]); + StringAssert.StartsWith(String.Format("Validatie van '{0}' beëindigd om: ", name), msgs.Last()); + }); + Assert.IsFalse(isValid); + } + + [Test] + public void Validate_CalculationWithoutEntryPointL_LogsErrorAndReturnsFalse() + { + // Setup + const string name = ""; + + PipingCalculation calculation = PipingCalculationFactory.CreateCalculationWithValidInput(); + calculation.InputParameters.EntryPointL = (RoundedDouble) double.NaN; + calculation.Name = name; + + // Call + bool isValid = false; + Action call = () => isValid = PipingCalculationService.Validate(calculation); + + // Assert + TestHelper.AssertLogMessages(call, messages => + { + var msgs = messages.ToArray(); + Assert.AreEqual(3, msgs.Length); + StringAssert.StartsWith(String.Format("Validatie van '{0}' gestart om: ", name), msgs.First()); + StringAssert.StartsWith("Validatie mislukt: Er is geen waarde voor het intredepunt opgegeven.", msgs[1]); + StringAssert.StartsWith(String.Format("Validatie van '{0}' beëindigd om: ", name), msgs.Last()); + }); + Assert.IsFalse(isValid); + } + + [Test] + public void Validate_CalculationWithoutExitPointL_LogsErrorAndReturnsFalse() + { + // Setup + const string name = ""; + + PipingCalculation calculation = PipingCalculationFactory.CreateCalculationWithValidInput(); + calculation.InputParameters.ExitPointL = (RoundedDouble)double.NaN; + calculation.Name = name; + + // Call + bool isValid = false; + Action call = () => isValid = PipingCalculationService.Validate(calculation); + + // Assert + TestHelper.AssertLogMessages(call, messages => + { + var msgs = messages.ToArray(); + Assert.AreEqual(3, msgs.Length); + StringAssert.StartsWith(String.Format("Validatie van '{0}' gestart om: ", name), msgs.First()); + StringAssert.StartsWith("Validatie mislukt: Er is geen waarde voor het uittredepunt opgegeven.", msgs[1]); + StringAssert.StartsWith(String.Format("Validatie van '{0}' beëindigd om: ", name), msgs.Last()); + }); + Assert.IsFalse(isValid); + } + + [Test] + [TestCase(0.5)] + [TestCase(0.5+1e-6)] + [TestCase(0.6)] + [TestCase(1.6)] + public void Validate_CalculationWithExitPointLBeforeEntryPointL_LogsErrorAndReturnsFalse(double entryPointL) + { + // Setup + const string name = ""; + + PipingCalculation calculation = PipingCalculationFactory.CreateCalculationWithValidInput(); + calculation.InputParameters.ExitPointL = (RoundedDouble) 0.5; + calculation.InputParameters.EntryPointL = (RoundedDouble) entryPointL; + calculation.Name = name; + + // Call + bool isValid = false; + Action call = () => isValid = PipingCalculationService.Validate(calculation); + + // Assert + TestHelper.AssertLogMessages(call, messages => + { + var msgs = messages.ToArray(); + Assert.AreEqual(3, msgs.Length); + StringAssert.StartsWith(String.Format("Validatie van '{0}' gestart om: ", name), msgs.First()); + StringAssert.StartsWith("Validatie mislukt: Het uittredepunt ligt niet voorbij het intredepunt.", msgs[1]); + StringAssert.StartsWith(String.Format("Validatie van '{0}' beëindigd om: ", name), msgs.Last()); + }); + Assert.IsFalse(isValid); + } + + [Test] + public void Validate_CalculationWithoutSurfaceLine_LogsErrorAndReturnsFalse() + { + // Setup + const string name = ""; + + PipingCalculation calculation = PipingCalculationFactory.CreateCalculationWithValidInput(); + calculation.InputParameters.SurfaceLine = null; + calculation.InputParameters.ExitPointL = (RoundedDouble) 0.9; + calculation.InputParameters.EntryPointL = (RoundedDouble) 0.1; + calculation.Name = name; + + // Call + bool isValid = false; + Action call = () => isValid = PipingCalculationService.Validate(calculation); + + // Assert + TestHelper.AssertLogMessages(call, messages => + { + var msgs = messages.ToArray(); + Assert.AreEqual(3, msgs.Length); + StringAssert.StartsWith(String.Format("Validatie van '{0}' gestart om: ", name), msgs.First()); + StringAssert.StartsWith("Validatie mislukt: Er is geen profielschematisatie geselecteerd.", msgs[1]); + StringAssert.StartsWith(String.Format("Validatie van '{0}' beëindigd om: ", name), msgs.Last()); + }); + Assert.IsFalse(isValid); + } + + [Test] + public void Validate_CalculationWithoutStochasticSoilProfile_LogsErrorAndReturnsFalse() + { + // Setup + const string name = ""; + + PipingCalculation calculation = PipingCalculationFactory.CreateCalculationWithValidInput(); + calculation.InputParameters.StochasticSoilProfile = null; + calculation.Name = name; + + // Call + bool isValid = false; + Action call = () => isValid = PipingCalculationService.Validate(calculation); + + // Assert + TestHelper.AssertLogMessages(call, messages => + { + var msgs = messages.ToArray(); + Assert.AreEqual(3, msgs.Length); + StringAssert.StartsWith(String.Format("Validatie van '{0}' gestart om: ", name), msgs.First()); + StringAssert.StartsWith("Validatie mislukt: Er is geen stochastisch ondergrondprofiel geselecteerd.", msgs[1]); + StringAssert.StartsWith(String.Format("Validatie van '{0}' beëindigd om: ", name), msgs.Last()); + }); + Assert.IsFalse(isValid); + } + + [Test] + public void Validate_CalculationWithExitPointPastLocalizedSurfaceLine_LogsErrorAndReturnsFalse() + { + // Setup + const string name = ""; + + PipingCalculation calculation = PipingCalculationFactory.CreateCalculationWithValidInput(); + calculation.InputParameters.ExitPointL = (RoundedDouble) 1.1; + calculation.Name = name; + + // Call + bool isValid = false; + Action call = () => isValid = PipingCalculationService.Validate(calculation); + + // Assert + TestHelper.AssertLogMessages(call, messages => + { + var msgs = messages.ToArray(); + Assert.AreEqual(4, msgs.Length); + StringAssert.StartsWith(String.Format("Validatie van '{0}' gestart om: ", name), msgs.First()); StringAssert.StartsWith("Validatie mislukt: Kan de dikte van het watervoerend pakket niet afleiden op basis van de invoer.", msgs[1]); StringAssert.StartsWith("Validatie mislukt: Kan de dikte van de deklaag niet afleiden op basis van de invoer.", msgs[2]); StringAssert.StartsWith(String.Format("Validatie van '{0}' beëindigd om: ", name), msgs.Last());