Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/Probabilistics/DeterministicDesignVariableTest.cs =================================================================== diff -u -rb7563238aa805cb6207e948a97f6fcc9e52c92b2 -r5803275ea1237501fd8a9fdd9d1f795d98d0aa4c --- Ringtoets/Common/test/Ringtoets.Common.Data.Test/Probabilistics/DeterministicDesignVariableTest.cs (.../DeterministicDesignVariableTest.cs) (revision b7563238aa805cb6207e948a97f6fcc9e52c92b2) +++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/Probabilistics/DeterministicDesignVariableTest.cs (.../DeterministicDesignVariableTest.cs) (revision 5803275ea1237501fd8a9fdd9d1f795d98d0aa4c) @@ -46,7 +46,7 @@ // Assert Assert.AreSame(distributionMock, designVariable.Distribution); Assert.AreEqual(0, designVariable.GetDesignValue().Value); - mocks.VerifyAll(); // Expect no calls on mocks + mocks.VerifyAll(); } [Test] @@ -107,7 +107,7 @@ // Assert Assert.AreEqual(testValue, designValue.Value, designValue.GetAccuracy()); Assert.AreEqual(numberOfDecimalPlaces, designValue.NumberOfDecimalPlaces); - mocks.VerifyAll(); // Expect no calls on mocks + mocks.VerifyAll(); } } } \ No newline at end of file Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingOutput.cs =================================================================== diff -u -rd7ac6da9fa00d17a03d6912000c889172bbf12ad -r5803275ea1237501fd8a9fdd9d1f795d98d0aa4c --- Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingOutput.cs (.../PipingOutput.cs) (revision d7ac6da9fa00d17a03d6912000c889172bbf12ad) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingOutput.cs (.../PipingOutput.cs) (revision 5803275ea1237501fd8a9fdd9d1f795d98d0aa4c) @@ -112,6 +112,23 @@ public class ConstructionProperties { /// + /// Creates a new instance of . + /// + public ConstructionProperties() + { + UpliftZValue = double.NaN; + UpliftFactorOfSafety = double.NaN; + HeaveZValue = double.NaN; + HeaveFactorOfSafety = double.NaN; + SellmeijerZValue = double.NaN; + SellmeijerFactorOfSafety = double.NaN; + HeaveGradient = double.NaN; + SellmeijerCreepCoefficient = double.NaN; + SellmeijerCriticalFall = double.NaN; + SellmeijerReducedFall = double.NaN; + } + + /// /// The calculated z-value for the uplift sub calculation. /// public double UpliftZValue { internal get; set; } @@ -160,23 +177,6 @@ /// The reduced fall that was calculated for the Sellmeijer sub calculation. /// public double SellmeijerReducedFall { internal get; set; } - - /// - /// Creates a new instance of . - /// - public ConstructionProperties() - { - UpliftZValue = double.NaN; - UpliftFactorOfSafety = double.NaN; - HeaveZValue = double.NaN; - HeaveFactorOfSafety = double.NaN; - SellmeijerZValue = double.NaN; - SellmeijerFactorOfSafety = double.NaN; - HeaveGradient = double.NaN; - SellmeijerCreepCoefficient = double.NaN; - SellmeijerCriticalFall = double.NaN; - SellmeijerReducedFall = double.NaN; - } } } } \ No newline at end of file Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingSoilProfileExtensions.cs =================================================================== diff -u -r5a97661a957b3500e532f449ebfdfa55783450d1 -r5803275ea1237501fd8a9fdd9d1f795d98d0aa4c --- Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingSoilProfileExtensions.cs (.../PipingSoilProfileExtensions.cs) (revision 5a97661a957b3500e532f449ebfdfa55783450d1) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingSoilProfileExtensions.cs (.../PipingSoilProfileExtensions.cs) (revision 5803275ea1237501fd8a9fdd9d1f795d98d0aa4c) @@ -102,7 +102,7 @@ /// The total thickness of the consecutive layers below the given . /// Thrown when either or /// is null. - /// Thrown when the bottom most is not part of + /// Thrown when the bottommost is not part of /// . private static double TotalThicknessOfConsecutiveLayersBelowLevel(PipingSoilProfile soilProfile, double level, PipingSoilLayer[] layers) { Index: Ringtoets/Piping/src/Ringtoets.Piping.KernelWrapper/PipingCalculatorResult.cs =================================================================== diff -u -rd7ac6da9fa00d17a03d6912000c889172bbf12ad -r5803275ea1237501fd8a9fdd9d1f795d98d0aa4c --- Ringtoets/Piping/src/Ringtoets.Piping.KernelWrapper/PipingCalculatorResult.cs (.../PipingCalculatorResult.cs) (revision d7ac6da9fa00d17a03d6912000c889172bbf12ad) +++ Ringtoets/Piping/src/Ringtoets.Piping.KernelWrapper/PipingCalculatorResult.cs (.../PipingCalculatorResult.cs) (revision 5803275ea1237501fd8a9fdd9d1f795d98d0aa4c) @@ -53,66 +53,29 @@ SellmeijerReducedFall = constructionProperties.SellmeijerReducedFall; } - #region properties - /// - /// Gets the z-value of the Uplift sub calculation. - /// - public double UpliftZValue { get; private set; } - - /// - /// Gets the factory of safety of the Uplift sub calculation. - /// - public double UpliftFactorOfSafety { get; private set; } - - /// - /// Gets the z-value of the Heave sub calculation. - /// - public double HeaveZValue { get; private set; } - - /// - /// Gets the factory of safety of the Heave sub calculation. - /// - public double HeaveFactorOfSafety { get; private set; } - - /// - /// Gets the z-value of the Sellmeijer sub calculation. - /// - public double SellmeijerZValue { get; private set; } - - /// - /// Gets the factory of safety of the Sellmeijer sub calculation. - /// - public double SellmeijerFactorOfSafety { get; private set; } - - /// - /// The gradient that was calculated for the heave sub calculation. - /// - public double HeaveGradient { get; private set; } - - /// - /// The creep coefficient that was calculated for the Sellmeijer sub calculation. - /// - public double SellmeijerCreepCoefficient { get; private set; } - - /// - /// The critical fall that was calculated for the Sellmeijer sub calculation. - /// - public double SellmeijerCriticalFall { get; private set; } - - /// - /// The reduced fall that was calculated for the Sellmeijer sub calculation. - /// - public double SellmeijerReducedFall { get; private set; } - - #endregion - - /// /// Container for properties for constructing a . /// public class ConstructionProperties { /// + /// Creates a new instance of . + /// + public ConstructionProperties() + { + UpliftZValue = double.NaN; + UpliftFactorOfSafety = double.NaN; + HeaveZValue = double.NaN; + HeaveFactorOfSafety = double.NaN; + SellmeijerZValue = double.NaN; + SellmeijerFactorOfSafety = double.NaN; + HeaveGradient = double.NaN; + SellmeijerCreepCoefficient = double.NaN; + SellmeijerCriticalFall = double.NaN; + SellmeijerReducedFall = double.NaN; + } + + /// /// Gets the z-value of the Uplift sub calculation. /// public double UpliftZValue { internal get; set; } @@ -161,23 +124,60 @@ /// The reduced fall that was calculated for the Sellmeijer sub calculation. /// public double SellmeijerReducedFall { internal get; set; } - - /// - /// Creates a new instance of . - /// - public ConstructionProperties() - { - UpliftZValue = double.NaN; - UpliftFactorOfSafety = double.NaN; - HeaveZValue = double.NaN; - HeaveFactorOfSafety = double.NaN; - SellmeijerZValue = double.NaN; - SellmeijerFactorOfSafety = double.NaN; - HeaveGradient = double.NaN; - SellmeijerCreepCoefficient = double.NaN; - SellmeijerCriticalFall = double.NaN; - SellmeijerReducedFall = double.NaN; - } } + + #region properties + + /// + /// Gets the z-value of the Uplift sub calculation. + /// + public double UpliftZValue { get; private set; } + + /// + /// Gets the factory of safety of the Uplift sub calculation. + /// + public double UpliftFactorOfSafety { get; private set; } + + /// + /// Gets the z-value of the Heave sub calculation. + /// + public double HeaveZValue { get; private set; } + + /// + /// Gets the factory of safety of the Heave sub calculation. + /// + public double HeaveFactorOfSafety { get; private set; } + + /// + /// Gets the z-value of the Sellmeijer sub calculation. + /// + public double SellmeijerZValue { get; private set; } + + /// + /// Gets the factory of safety of the Sellmeijer sub calculation. + /// + public double SellmeijerFactorOfSafety { get; private set; } + + /// + /// The gradient that was calculated for the heave sub calculation. + /// + public double HeaveGradient { get; private set; } + + /// + /// The creep coefficient that was calculated for the Sellmeijer sub calculation. + /// + public double SellmeijerCreepCoefficient { get; private set; } + + /// + /// The critical fall that was calculated for the Sellmeijer sub calculation. + /// + public double SellmeijerCriticalFall { get; private set; } + + /// + /// The reduced fall that was calculated for the Sellmeijer sub calculation. + /// + public double SellmeijerReducedFall { get; private set; } + + #endregion } } \ No newline at end of file Index: Ringtoets/Piping/src/Ringtoets.Piping.KernelWrapper/SubCalculator/IHeaveCalculator.cs =================================================================== diff -u -r11442d016c7154e924e51d58d948752a1221f27a -r5803275ea1237501fd8a9fdd9d1f795d98d0aa4c --- Ringtoets/Piping/src/Ringtoets.Piping.KernelWrapper/SubCalculator/IHeaveCalculator.cs (.../IHeaveCalculator.cs) (revision 11442d016c7154e924e51d58d948752a1221f27a) +++ Ringtoets/Piping/src/Ringtoets.Piping.KernelWrapper/SubCalculator/IHeaveCalculator.cs (.../IHeaveCalculator.cs) (revision 5803275ea1237501fd8a9fdd9d1f795d98d0aa4c) @@ -59,7 +59,7 @@ double RExit { set; } /// - /// Sets the bottom level of the bottom most aquitard that is above the exit point's z-coordinate. + /// Sets the bottom level of the bottommost aquitard that is above the exit point's z-coordinate. /// double BottomLevelAquitardAboveExitPointZ { set; } Index: Ringtoets/Piping/src/Ringtoets.Piping.KernelWrapper/SubCalculator/IPipingProfilePropertyCalculator.cs =================================================================== diff -u -r11442d016c7154e924e51d58d948752a1221f27a -r5803275ea1237501fd8a9fdd9d1f795d98d0aa4c --- Ringtoets/Piping/src/Ringtoets.Piping.KernelWrapper/SubCalculator/IPipingProfilePropertyCalculator.cs (.../IPipingProfilePropertyCalculator.cs) (revision 11442d016c7154e924e51d58d948752a1221f27a) +++ Ringtoets/Piping/src/Ringtoets.Piping.KernelWrapper/SubCalculator/IPipingProfilePropertyCalculator.cs (.../IPipingProfilePropertyCalculator.cs) (revision 5803275ea1237501fd8a9fdd9d1f795d98d0aa4c) @@ -45,7 +45,7 @@ double ExitPointX { set; } /// - /// Gets the bottom level of the bottom most aquitard that is above the exit point's z-coordinate. + /// Gets the bottom level of the bottommost aquitard that is above the exit point's z-coordinate. /// double BottomAquitardLayerAboveExitPointZ { get; } Index: Ringtoets/Piping/src/Ringtoets.Piping.KernelWrapper/SubCalculator/ISellmeijerCalculator.cs =================================================================== diff -u -r11442d016c7154e924e51d58d948752a1221f27a -r5803275ea1237501fd8a9fdd9d1f795d98d0aa4c --- Ringtoets/Piping/src/Ringtoets.Piping.KernelWrapper/SubCalculator/ISellmeijerCalculator.cs (.../ISellmeijerCalculator.cs) (revision 11442d016c7154e924e51d58d948752a1221f27a) +++ Ringtoets/Piping/src/Ringtoets.Piping.KernelWrapper/SubCalculator/ISellmeijerCalculator.cs (.../ISellmeijerCalculator.cs) (revision 5803275ea1237501fd8a9fdd9d1f795d98d0aa4c) @@ -109,7 +109,7 @@ double WhitesDragCoefficient { set; } /// - /// Sets the bottom level of the bottom most aquitard that is above the exit point's z-coordinate. + /// Sets the bottom level of the bottommost aquitard that is above the exit point's z-coordinate. /// double BottomLevelAquitardAboveExitPointZ { set; } Index: Ringtoets/Piping/src/Ringtoets.Piping.Service/PipingCalculationService.cs =================================================================== diff -u -re341f0fbf9e8764d8580e1e909109e8b5941273a -r5803275ea1237501fd8a9fdd9d1f795d98d0aa4c --- Ringtoets/Piping/src/Ringtoets.Piping.Service/PipingCalculationService.cs (.../PipingCalculationService.cs) (revision e341f0fbf9e8764d8580e1e909109e8b5941273a) +++ Ringtoets/Piping/src/Ringtoets.Piping.Service/PipingCalculationService.cs (.../PipingCalculationService.cs) (revision 5803275ea1237501fd8a9fdd9d1f795d98d0aa4c) @@ -50,7 +50,7 @@ CalculationServiceHelper.LogValidationBeginTime(calculation.Name); CalculationServiceHelper.LogMessagesAsWarning(GetInputWarnings(calculation.InputParameters).ToArray()); - var inputValidationResults = ValidateInput(calculation.InputParameters); + List inputValidationResults = ValidateInput(calculation.InputParameters); if (inputValidationResults.Count > 0) { CalculationServiceHelper.LogMessagesAsError(RingtoetsCommonServiceResources.Error_in_validation_0, inputValidationResults.ToArray()); @@ -114,8 +114,7 @@ IEnumerable coreValidationError = ValidateCoreSurfaceLineAndSoilProfileProperties(inputParameters); validationResults.AddRange(coreValidationError); - var isEntryPointLMissing = double.IsNaN(inputParameters.EntryPointL); - if (isEntryPointLMissing) + if (double.IsNaN(inputParameters.EntryPointL)) { validationResults.Add(Resources.PipingCalculationService_ValidateInput_No_value_for_EntryPointL); } @@ -127,7 +126,7 @@ return validationResults; } - + private static IEnumerable ValidateHydraulics(PipingInput inputParameters) { var validationResults = new List(); @@ -139,7 +138,7 @@ { validationResults.AddRange(ValidateAssessmentLevel(inputParameters)); - if (double.IsNaN(inputParameters.PiezometricHeadExit) || double.IsInfinity(inputParameters.PiezometricHeadExit)) + if (IsInconcreteValue(inputParameters.PiezometricHeadExit)) { validationResults.Add(Resources.PipingCalculationService_ValidateInput_Cannot_determine_PiezometricHeadExit); } @@ -154,7 +153,7 @@ if (inputParameters.UseAssessmentLevelManualInput) { - if (double.IsNaN(inputParameters.AssessmentLevel) || double.IsInfinity(inputParameters.AssessmentLevel)) + if (IsInconcreteValue(inputParameters.AssessmentLevel)) { validationResult.Add(string.Format(RingtoetsCommonServiceResources.Validation_ValidateInput_No_concrete_value_entered_for_ParameterName_0_, ParameterNameExtractor.GetFromDisplayName(RingtoetsCommonFormsResources.AssessmentLevel_DisplayName))); @@ -171,6 +170,11 @@ return validationResult; } + private static bool IsInconcreteValue(RoundedDouble parameter) + { + return double.IsNaN(parameter) || double.IsInfinity(parameter); + } + private static IEnumerable ValidateCoreSurfaceLineAndSoilProfileProperties(PipingInput inputParameters) { var validationResults = new List(); @@ -202,8 +206,8 @@ validationResults.Add(Resources.PipingCalculationService_ValidateInput_Cannot_determine_thickness_coverage_layer); } - var pipingSoilProfile = inputParameters.StochasticSoilProfile.SoilProfile; - var surfaceLevel = inputParameters.SurfaceLine.GetZAtL(inputParameters.ExitPointL); + PipingSoilProfile pipingSoilProfile = inputParameters.StochasticSoilProfile.SoilProfile; + double surfaceLevel = inputParameters.SurfaceLine.GetZAtL(inputParameters.ExitPointL); validationResults.AddRange(ValidateAquiferLayers(inputParameters, pipingSoilProfile, surfaceLevel)); validationResults.AddRange(ValidateCoverageLayers(inputParameters, pipingSoilProfile, surfaceLevel)); @@ -245,7 +249,7 @@ } else { - var saturatedVolumicWeightOfCoverageLayer = + RoundedDouble saturatedVolumicWeightOfCoverageLayer = PipingSemiProbabilisticDesignValueFactory.GetSaturatedVolumicWeightOfCoverageLayer(inputParameters).GetDesignValue(); if (double.IsNaN(saturatedVolumicWeightOfCoverageLayer)) @@ -267,7 +271,7 @@ if (IsSurfaceLineProfileDefinitionComplete(inputParameters)) { - var surfaceLineLevel = inputParameters.SurfaceLine.GetZAtL(inputParameters.ExitPointL); + double surfaceLineLevel = inputParameters.SurfaceLine.GetZAtL(inputParameters.ExitPointL); warnings.AddRange(GetMultipleAquiferLayersWarning(inputParameters, surfaceLineLevel)); warnings.AddRange(GetMultipleCoverageLayersWarning(inputParameters, surfaceLineLevel)); Index: Ringtoets/Piping/test/Ringtoets.Piping.KernelWrapper.Test/PipingCalculatorResultTest.cs =================================================================== diff -u -r4f36e5da39fa486021eefaf352ca05c96dcdab43 -r5803275ea1237501fd8a9fdd9d1f795d98d0aa4c --- Ringtoets/Piping/test/Ringtoets.Piping.KernelWrapper.Test/PipingCalculatorResultTest.cs (.../PipingCalculatorResultTest.cs) (revision 4f36e5da39fa486021eefaf352ca05c96dcdab43) +++ Ringtoets/Piping/test/Ringtoets.Piping.KernelWrapper.Test/PipingCalculatorResultTest.cs (.../PipingCalculatorResultTest.cs) (revision 5803275ea1237501fd8a9fdd9d1f795d98d0aa4c) @@ -73,7 +73,7 @@ var sellmeijerCriticalFall = random.NextDouble(); var sellmeijerReducedFall = random.NextDouble(); - var builder = new PipingCalculatorResult.ConstructionProperties + var constructionProperties = new PipingCalculatorResult.ConstructionProperties { UpliftZValue = zuValue, UpliftFactorOfSafety = foSuValue, @@ -88,7 +88,7 @@ }; // Call - var actual = new PipingCalculatorResult(builder); + var actual = new PipingCalculatorResult(constructionProperties); // Assert Assert.AreEqual(zuValue, actual.UpliftZValue); Index: Ringtoets/Piping/test/Ringtoets.Piping.Service.Test/PipingCalculationServiceTest.cs =================================================================== diff -u -re341f0fbf9e8764d8580e1e909109e8b5941273a -r5803275ea1237501fd8a9fdd9d1f795d98d0aa4c --- Ringtoets/Piping/test/Ringtoets.Piping.Service.Test/PipingCalculationServiceTest.cs (.../PipingCalculationServiceTest.cs) (revision e341f0fbf9e8764d8580e1e909109e8b5941273a) +++ Ringtoets/Piping/test/Ringtoets.Piping.Service.Test/PipingCalculationServiceTest.cs (.../PipingCalculationServiceTest.cs) (revision 5803275ea1237501fd8a9fdd9d1f795d98d0aa4c) @@ -37,17 +37,27 @@ [TestFixture] public class PipingCalculationServiceTest { + private double testSurfaceLineTopLevel; + private PipingCalculationScenario testCalculation; + private const string averagingSoilLayerPropertiesMessage = "Meerdere aaneengesloten deklagen gevonden. De grondeigenschappen worden bepaald door het nemen van een gewogen gemiddelde, mits de standaardafwijkingen en verschuivingen voor alle lagen gelijk zijn."; + + [SetUp] + public void Setup() + { + testCalculation = PipingCalculationScenarioFactory.CreatePipingCalculationScenarioWithValidInput(); + testSurfaceLineTopLevel = testCalculation.InputParameters.SurfaceLine.Points.Max(p => p.Z); + } + [Test] public void Validate_Always_LogStartAndEndOfValidatingInputs() { // Setup const string name = ""; - PipingCalculation pipingCalculation = PipingCalculationScenarioFactory.CreatePipingCalculationScenarioWithValidInput(); - pipingCalculation.Name = name; + testCalculation.Name = name; // Call - Action call = () => PipingCalculationService.Validate(pipingCalculation); + Action call = () => PipingCalculationService.Validate(testCalculation); // Assert TestHelper.AssertLogMessages(call, messages => @@ -111,14 +121,13 @@ // Setup const string name = ""; - PipingCalculation calculation = PipingCalculationScenarioFactory.CreatePipingCalculationScenarioWithValidInput(); - calculation.Name = name; - calculation.InputParameters.HydraulicBoundaryLocation = new TestHydraulicBoundaryLocation(); - calculation.InputParameters.UseAssessmentLevelManualInput = false; + testCalculation.Name = name; + testCalculation.InputParameters.HydraulicBoundaryLocation = new TestHydraulicBoundaryLocation(); + testCalculation.InputParameters.UseAssessmentLevelManualInput = false; // Call bool isValid = false; - Action call = () => isValid = PipingCalculationService.Validate(calculation); + Action call = () => isValid = PipingCalculationService.Validate(testCalculation); // Assert TestHelper.AssertLogMessages(call, messages => @@ -142,14 +151,13 @@ // Setup const string name = ""; - PipingCalculation calculation = PipingCalculationScenarioFactory.CreatePipingCalculationScenarioWithValidInput(); - calculation.InputParameters.UseAssessmentLevelManualInput = true; - calculation.InputParameters.AssessmentLevel = (RoundedDouble) assessmentLevel; - calculation.Name = name; + testCalculation.InputParameters.UseAssessmentLevelManualInput = true; + testCalculation.InputParameters.AssessmentLevel = (RoundedDouble) assessmentLevel; + testCalculation.Name = name; // Call bool isValid = false; - Action call = () => isValid = PipingCalculationService.Validate(calculation); + Action call = () => isValid = PipingCalculationService.Validate(testCalculation); // Assert TestHelper.AssertLogMessages(call, messages => @@ -170,13 +178,12 @@ // Setup const string name = ""; - PipingCalculation calculation = PipingCalculationScenarioFactory.CreatePipingCalculationScenarioWithValidInput(); - calculation.InputParameters.EntryPointL = RoundedDouble.NaN; - calculation.Name = name; + testCalculation.InputParameters.EntryPointL = RoundedDouble.NaN; + testCalculation.Name = name; // Call bool isValid = false; - Action call = () => isValid = PipingCalculationService.Validate(calculation); + Action call = () => isValid = PipingCalculationService.Validate(testCalculation); // Assert TestHelper.AssertLogMessages(call, messages => @@ -196,13 +203,12 @@ // Setup const string name = ""; - PipingCalculation calculation = PipingCalculationScenarioFactory.CreatePipingCalculationScenarioWithValidInput(); - calculation.InputParameters.ExitPointL = RoundedDouble.NaN; - calculation.Name = name; + testCalculation.InputParameters.ExitPointL = RoundedDouble.NaN; + testCalculation.Name = name; // Call bool isValid = false; - Action call = () => isValid = PipingCalculationService.Validate(calculation); + Action call = () => isValid = PipingCalculationService.Validate(testCalculation); // Assert TestHelper.AssertLogMessages(call, messages => @@ -222,15 +228,14 @@ // Setup const string name = ""; - PipingCalculation calculation = PipingCalculationScenarioFactory.CreatePipingCalculationScenarioWithValidInput(); - calculation.InputParameters.SurfaceLine = null; - calculation.InputParameters.ExitPointL = (RoundedDouble) 0.9; - calculation.InputParameters.EntryPointL = (RoundedDouble) 0.1; - calculation.Name = name; + testCalculation.InputParameters.SurfaceLine = null; + testCalculation.InputParameters.ExitPointL = (RoundedDouble) 0.9; + testCalculation.InputParameters.EntryPointL = (RoundedDouble) 0.1; + testCalculation.Name = name; // Call bool isValid = false; - Action call = () => isValid = PipingCalculationService.Validate(calculation); + Action call = () => isValid = PipingCalculationService.Validate(testCalculation); // Assert TestHelper.AssertLogMessages(call, messages => @@ -250,14 +255,13 @@ // Setup const string name = ""; - PipingCalculation calculation = PipingCalculationScenarioFactory.CreatePipingCalculationScenarioWithValidInput(); - calculation.InputParameters.StochasticSoilProfile = null; - calculation.Name = name; + testCalculation.InputParameters.StochasticSoilProfile = null; + testCalculation.Name = name; bool isValid = false; // Call - Action call = () => isValid = PipingCalculationService.Validate(calculation); + Action call = () => isValid = PipingCalculationService.Validate(testCalculation); // Assert TestHelper.AssertLogMessages(call, messages => @@ -277,9 +281,7 @@ // Setup const string name = ""; - PipingCalculation calculation = PipingCalculationScenarioFactory.CreatePipingCalculationScenarioWithValidInput(); - - var topLayer = new PipingSoilLayer(10.56 - 1e-6) + var topLayer = new PipingSoilLayer(testSurfaceLineTopLevel - 1e-6) { IsAquifer = false, BelowPhreaticLevelMean = 15, @@ -294,7 +296,7 @@ PermeabilityDeviation = 0.5, PermeabilityMean = 1 }; - calculation.InputParameters.StochasticSoilProfile.SoilProfile = new PipingSoilProfile( + testCalculation.InputParameters.StochasticSoilProfile.SoilProfile = new PipingSoilProfile( string.Empty, 0.0, new[] { @@ -303,12 +305,12 @@ }, SoilProfileType.SoilProfile1D, -1); - calculation.Name = name; + testCalculation.Name = name; bool isValid = false; // Call - Action call = () => isValid = PipingCalculationService.Validate(calculation); + Action call = () => isValid = PipingCalculationService.Validate(testCalculation); // Assert TestHelper.AssertLogMessages(call, messages => @@ -339,14 +341,13 @@ }, SoilProfileType.SoilProfile1D, -1); - PipingCalculation calculation = PipingCalculationScenarioFactory.CreatePipingCalculationScenarioWithValidInput(); - calculation.InputParameters.StochasticSoilProfile.SoilProfile = profile; - calculation.Name = name; + testCalculation.InputParameters.StochasticSoilProfile.SoilProfile = profile; + testCalculation.Name = name; bool isValid = false; // Call - Action call = () => isValid = PipingCalculationService.Validate(calculation); + Action call = () => isValid = PipingCalculationService.Validate(testCalculation); // Assert TestHelper.AssertLogMessages(call, messages => @@ -384,14 +385,13 @@ }, SoilProfileType.SoilProfile1D, -1); - PipingCalculation calculation = PipingCalculationScenarioFactory.CreatePipingCalculationScenarioWithValidInput(); - calculation.InputParameters.StochasticSoilProfile.SoilProfile = profile; - calculation.Name = name; + testCalculation.InputParameters.StochasticSoilProfile.SoilProfile = profile; + testCalculation.Name = name; bool isValid = false; // Call - Action call = () => isValid = PipingCalculationService.Validate(calculation); + Action call = () => isValid = PipingCalculationService.Validate(testCalculation); // Assert TestHelper.AssertLogMessages(call, messages => @@ -432,14 +432,13 @@ }, SoilProfileType.SoilProfile1D, -1); - PipingCalculation calculation = PipingCalculationScenarioFactory.CreatePipingCalculationScenarioWithValidInput(); - calculation.InputParameters.StochasticSoilProfile.SoilProfile = profile; - calculation.Name = name; + testCalculation.InputParameters.StochasticSoilProfile.SoilProfile = profile; + testCalculation.Name = name; bool isValid = false; // Call - Action call = () => isValid = PipingCalculationService.Validate(calculation); + Action call = () => isValid = PipingCalculationService.Validate(testCalculation); // Assert TestHelper.AssertLogMessages(call, messages => @@ -465,7 +464,7 @@ var belowPhreaticLevelShift = 1; var belowPhreaticLevelMeanBase = 15.0; - var topCoverageLayer = new PipingSoilLayer(10.56) + var topCoverageLayer = new PipingSoilLayer(testSurfaceLineTopLevel) { IsAquifer = false, BelowPhreaticLevelDeviation = belowPhreaticLevelDeviation, @@ -497,22 +496,21 @@ }, SoilProfileType.SoilProfile1D, -1); - PipingCalculation calculation = PipingCalculationScenarioFactory.CreatePipingCalculationScenarioWithValidInput(); - calculation.InputParameters.StochasticSoilProfile.SoilProfile = profile; - calculation.Name = name; + testCalculation.InputParameters.StochasticSoilProfile.SoilProfile = profile; + testCalculation.Name = name; bool isValid = false; // Call - Action call = () => isValid = PipingCalculationService.Validate(calculation); + Action call = () => isValid = PipingCalculationService.Validate(testCalculation); // Assert TestHelper.AssertLogMessages(call, messages => { string[] msgs = messages.ToArray(); Assert.AreEqual(3, msgs.Length); StringAssert.StartsWith(string.Format("Validatie van '{0}' gestart om: ", name), msgs.First()); - Assert.AreEqual("Meerdere aaneengesloten deklagen gevonden. De grondeigenschappen worden bepaald door het nemen van een gewogen gemiddelde, mits de standaardafwijkingen en verschuivingen voor alle lagen gelijk zijn.", msgs[1]); + Assert.AreEqual(averagingSoilLayerPropertiesMessage, msgs[1]); StringAssert.StartsWith(string.Format("Validatie van '{0}' beƫindigd om: ", name), msgs.Last()); }); Assert.IsTrue(isValid); @@ -543,7 +541,7 @@ incompletePipingSoilLayer.DiameterD70Deviation = random.NextDouble(); } - var completeLayer = new PipingSoilLayer(10.56) + var completeLayer = new PipingSoilLayer(testSurfaceLineTopLevel) { IsAquifer = false, BelowPhreaticLevelDeviation = random.GetFromRange(1e-6, 5.0), @@ -559,14 +557,13 @@ }, SoilProfileType.SoilProfile1D, -1); - PipingCalculation calculation = PipingCalculationScenarioFactory.CreatePipingCalculationScenarioWithValidInput(); - calculation.InputParameters.StochasticSoilProfile.SoilProfile = profile; - calculation.Name = name; + testCalculation.InputParameters.StochasticSoilProfile.SoilProfile = profile; + testCalculation.Name = name; bool isValid = false; // Call - Action call = () => isValid = PipingCalculationService.Validate(calculation); + Action call = () => isValid = PipingCalculationService.Validate(testCalculation); // Assert TestHelper.AssertLogMessages(call, messages => @@ -597,7 +594,7 @@ DiameterD70Mean = diameter70Value, DiameterD70Deviation = 0 }; - var validLayer = new PipingSoilLayer(10.56) + var validLayer = new PipingSoilLayer(testSurfaceLineTopLevel) { IsAquifer = false, BelowPhreaticLevelDeviation = random.GetFromRange(1e-6, 5.0), @@ -612,14 +609,13 @@ }, SoilProfileType.SoilProfile1D, -1); - PipingCalculation pipingCalculation = PipingCalculationScenarioFactory.CreatePipingCalculationScenarioWithValidInput(); - pipingCalculation.Name = name; - pipingCalculation.InputParameters.StochasticSoilProfile.SoilProfile = profile; + testCalculation.Name = name; + testCalculation.InputParameters.StochasticSoilProfile.SoilProfile = profile; bool isValid = false; // Call - Action call = () => isValid = PipingCalculationService.Validate(pipingCalculation); + Action call = () => isValid = PipingCalculationService.Validate(testCalculation); // Assert TestHelper.AssertLogMessages(call, messages => @@ -659,7 +655,7 @@ incompletePipingSoilLayer.PermeabilityDeviation = random.NextDouble(); } - var completeLayer = new PipingSoilLayer(10.56) + var completeLayer = new PipingSoilLayer(testSurfaceLineTopLevel) { IsAquifer = false, BelowPhreaticLevelDeviation = random.GetFromRange(1e-6, 999.999), @@ -675,14 +671,13 @@ }, SoilProfileType.SoilProfile1D, -1); - PipingCalculation calculation = PipingCalculationScenarioFactory.CreatePipingCalculationScenarioWithValidInput(); - calculation.InputParameters.StochasticSoilProfile.SoilProfile = profile; - calculation.Name = name; + testCalculation.InputParameters.StochasticSoilProfile.SoilProfile = profile; + testCalculation.Name = name; bool isValid = false; // Call - Action call = () => isValid = PipingCalculationService.Validate(calculation); + Action call = () => isValid = PipingCalculationService.Validate(testCalculation); // Assert TestHelper.AssertLogMessages(call, messages => @@ -707,7 +702,7 @@ const string name = ""; var random = new Random(21); - var incompletePipingSoilLayer = new PipingSoilLayer(10.56) + var incompletePipingSoilLayer = new PipingSoilLayer(testSurfaceLineTopLevel) { IsAquifer = false }; @@ -741,14 +736,13 @@ }, SoilProfileType.SoilProfile1D, -1); - PipingCalculation calculation = PipingCalculationScenarioFactory.CreatePipingCalculationScenarioWithValidInput(); - calculation.InputParameters.StochasticSoilProfile.SoilProfile = profile; - calculation.Name = name; + testCalculation.InputParameters.StochasticSoilProfile.SoilProfile = profile; + testCalculation.Name = name; bool isValid = false; // Call - Action call = () => isValid = PipingCalculationService.Validate(calculation); + Action call = () => isValid = PipingCalculationService.Validate(testCalculation); // Assert TestHelper.AssertLogMessages(call, messages => @@ -768,7 +762,7 @@ // Setup const string name = ""; - var coverageLayerInvalidSaturatedVolumicWeight = new PipingSoilLayer(10.56) + var coverageLayerInvalidSaturatedVolumicWeight = new PipingSoilLayer(testSurfaceLineTopLevel) { IsAquifer = false, BelowPhreaticLevelMean = 9.81, @@ -791,14 +785,13 @@ }, SoilProfileType.SoilProfile1D, -1); - PipingCalculation pipingCalculation = PipingCalculationScenarioFactory.CreatePipingCalculationScenarioWithValidInput(); - pipingCalculation.Name = name; - pipingCalculation.InputParameters.StochasticSoilProfile.SoilProfile = profile; + testCalculation.Name = name; + testCalculation.InputParameters.StochasticSoilProfile.SoilProfile = profile; bool isValid = false; // Call - Action call = () => isValid = PipingCalculationService.Validate(pipingCalculation); + Action call = () => isValid = PipingCalculationService.Validate(testCalculation); // Assert TestHelper.AssertLogMessages(call, messages => @@ -821,7 +814,7 @@ // Setup const string name = ""; - var topCoverageLayer = new PipingSoilLayer(10.56) + var topCoverageLayer = new PipingSoilLayer(testSurfaceLineTopLevel) { IsAquifer = false, BelowPhreaticLevelMean = 5, @@ -852,23 +845,20 @@ }, SoilProfileType.SoilProfile1D, -1); - PipingCalculation pipingCalculation = PipingCalculationScenarioFactory.CreatePipingCalculationScenarioWithValidInput(); - pipingCalculation.Name = name; - pipingCalculation.InputParameters.StochasticSoilProfile.SoilProfile = profile; + testCalculation.Name = name; + testCalculation.InputParameters.StochasticSoilProfile.SoilProfile = profile; // Call - Action call = () => PipingCalculationService.Validate(pipingCalculation); + Action call = () => PipingCalculationService.Validate(testCalculation); // Assert TestHelper.AssertLogMessages(call, messages => { string[] msgs = messages.ToArray(); Assert.AreEqual(4, msgs.Length); StringAssert.StartsWith(string.Format("Validatie van '{0}' gestart om: ", name), msgs.First()); + Assert.AreEqual(averagingSoilLayerPropertiesMessage, msgs[1]); Assert.AreEqual( - "Meerdere aaneengesloten deklagen gevonden. De grondeigenschappen worden bepaald door het nemen van een gewogen gemiddelde, mits de standaardafwijkingen en verschuivingen voor alle lagen gelijk zijn.", - msgs[1]); - Assert.AreEqual( "Validatie mislukt: Kan de definitie voor het verzadigd gewicht van de deklaag niet (volledig) afleiden.", msgs[2]); StringAssert.StartsWith(string.Format("Validatie van '{0}' beƫindigd om: ", name), msgs.Last()); @@ -879,13 +869,12 @@ public void Validate_CompleteInput_InputSetOnSubCalculators() { // Setup - PipingCalculation validPipingCalculation = PipingCalculationScenarioFactory.CreatePipingCalculationScenarioWithValidInput(); - PipingInput input = validPipingCalculation.InputParameters; + PipingInput input = testCalculation.InputParameters; using (new PipingSubCalculatorFactoryConfig()) { // Call - PipingCalculationService.Validate(validPipingCalculation); + PipingCalculationService.Validate(testCalculation); // Assert AssertSubCalculatorInputs(input); @@ -898,16 +887,15 @@ // Setup const string name = ""; - PipingCalculation validPipingCalculation = PipingCalculationScenarioFactory.CreatePipingCalculationScenarioWithValidInput(); - validPipingCalculation.Name = name; + testCalculation.Name = name; Action call = () => { // Precondition - Assert.IsTrue(PipingCalculationService.Validate(validPipingCalculation)); + Assert.IsTrue(PipingCalculationService.Validate(testCalculation)); // Call - PipingCalculationService.Calculate(validPipingCalculation); + PipingCalculationService.Calculate(testCalculation); }; // Assert @@ -925,18 +913,15 @@ [Test] public void Calculate_ValidPipingCalculationNoOutput_ShouldSetOutput() { - // Setup - PipingCalculation validPipingCalculation = PipingCalculationScenarioFactory.CreatePipingCalculationScenarioWithValidInput(); - // Precondition - Assert.IsNull(validPipingCalculation.Output); - Assert.IsTrue(PipingCalculationService.Validate(validPipingCalculation)); + Assert.IsNull(testCalculation.Output); + Assert.IsTrue(PipingCalculationService.Validate(testCalculation)); // Call - PipingCalculationService.Calculate(validPipingCalculation); + PipingCalculationService.Calculate(testCalculation); // Assert - Assert.IsNotNull(validPipingCalculation.Output); + Assert.IsNotNull(testCalculation.Output); } [Test] @@ -945,30 +930,28 @@ // Setup var output = new TestPipingOutput(); - PipingCalculation validPipingCalculation = PipingCalculationScenarioFactory.CreatePipingCalculationScenarioWithValidInput(); - validPipingCalculation.Output = output; + testCalculation.Output = output; // Precondition - Assert.IsTrue(PipingCalculationService.Validate(validPipingCalculation)); + Assert.IsTrue(PipingCalculationService.Validate(testCalculation)); // Call - PipingCalculationService.Calculate(validPipingCalculation); + PipingCalculationService.Calculate(testCalculation); // Assert - Assert.AreNotSame(output, validPipingCalculation.Output); + Assert.AreNotSame(output, testCalculation.Output); } [Test] public void Calculate_CompleteInput_InputSetOnSubCalculators() { // Setup - PipingCalculation validPipingCalculation = PipingCalculationScenarioFactory.CreatePipingCalculationScenarioWithValidInput(); - PipingInput input = validPipingCalculation.InputParameters; + PipingInput input = testCalculation.InputParameters; using (new PipingSubCalculatorFactoryConfig()) { // Call - PipingCalculationService.Calculate(validPipingCalculation); + PipingCalculationService.Calculate(testCalculation); // Assert AssertSubCalculatorInputs(input);