Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Service/MacroStabilityInwardsCalculationService.cs =================================================================== diff -u -rd6bbc2e5ae686671e772567f71ad3e9ef443e687 -re101eb0e5a72f40991c02f5ccdc408b74a1d2a2d --- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Service/MacroStabilityInwardsCalculationService.cs (.../MacroStabilityInwardsCalculationService.cs) (revision d6bbc2e5ae686671e772567f71ad3e9ef443e687) +++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.Service/MacroStabilityInwardsCalculationService.cs (.../MacroStabilityInwardsCalculationService.cs) (revision e101eb0e5a72f40991c02f5ccdc408b74a1d2a2d) @@ -57,14 +57,19 @@ /// General calculation parameters that are the same across all calculations. /// The normative assessment level to use in case the manual assessment level is not applicable. /// false if contains validation errors; true otherwise. - /// Thrown when is null. + /// Thrown when any parameter is null. public static bool Validate(MacroStabilityInwardsCalculation calculation, GeneralMacroStabilityInwardsInput generalInput, RoundedDouble normativeAssessmentLevel) { if (calculation == null) { throw new ArgumentNullException(nameof(calculation)); } + if (generalInput == null) + { + throw new ArgumentNullException(nameof(generalInput)); + } + CalculationServiceHelper.LogValidationBegin(); string[] inputValidationResults = MacroStabilityInwardsInputValidator.Validate(calculation.InputParameters, normativeAssessmentLevel).ToArray(); @@ -130,7 +135,7 @@ /// The to base the input for the calculation upon. /// General calculation parameters that are the same across all calculations. /// The normative assessment level to use in case the manual assessment level is not applicable. - /// Thrown when is null. + /// Thrown when any parameter is null. /// Thrown when an error (both expected or unexpected) occurred during the calculation. /// Consider calling first to see if calculation is possible. public static void Calculate(MacroStabilityInwardsCalculation calculation, GeneralMacroStabilityInwardsInput generalInput, RoundedDouble normativeAssessmentLevel) @@ -140,6 +145,11 @@ throw new ArgumentNullException(nameof(calculation)); } + if (generalInput == null) + { + throw new ArgumentNullException(nameof(generalInput)); + } + UpliftVanCalculatorResult macroStabilityInwardsResult; CalculationServiceHelper.LogCalculationBegin(); Index: Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.Service.Test/MacroStabilityInwardsCalculationServiceTest.cs =================================================================== diff -u -r603b8245aa12354a99ab2c7a4c706e91e3a91477 -re101eb0e5a72f40991c02f5ccdc408b74a1d2a2d --- Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.Service.Test/MacroStabilityInwardsCalculationServiceTest.cs (.../MacroStabilityInwardsCalculationServiceTest.cs) (revision 603b8245aa12354a99ab2c7a4c706e91e3a91477) +++ Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.Service.Test/MacroStabilityInwardsCalculationServiceTest.cs (.../MacroStabilityInwardsCalculationServiceTest.cs) (revision e101eb0e5a72f40991c02f5ccdc408b74a1d2a2d) @@ -61,7 +61,18 @@ var exception = Assert.Throws(Call); Assert.AreEqual("calculation", exception.ParamName); } + + [Test] + public void Validate_GeneralInputNull_ThrowArgumentNullException() + { + // Call + void Call() => MacroStabilityInwardsCalculationService.Validate(testCalculation, null, RoundedDouble.NaN); + // Assert + var exception = Assert.Throws(Call); + Assert.AreEqual("generalInput", exception.ParamName); + } + [Test] public void Validate_Always_LogStartAndEndOfValidatingInputs() { @@ -386,7 +397,20 @@ var exception = Assert.Throws(Call); Assert.AreEqual("calculation", exception.ParamName); } + + [Test] + public void Calculate_GeneralInputNull_ThrowArgumentNullException() + { + // Call + void Call() => MacroStabilityInwardsCalculationService.Calculate(testCalculation, + null, + RoundedDouble.NaN); + // Assert + var exception = Assert.Throws(Call); + Assert.AreEqual("generalInput", exception.ParamName); + } + [Test] public void Calculate_ValidCalculation_LogStartAndEndOfValidatingInputsAndCalculation() {