/// <summary> /// Calculates the Waternet with daily circumstances based on the values /// of the <see cref="IMacroStabilityInwardsWaternetInput"/>. /// </summary> /// <param name="input">The input to get the values from.</param> /// <param name="generalInput">General calculation parameters that are the same across all calculations.</param> /// <returns>A calculated <see cref="MacroStabilityInwardsWaternet"/>, /// or an empty <see cref="MacroStabilityInwardsWaternet"/> when the Waternet /// could not be calculated.</returns> /// <exception cref="ArgumentNullException">Thrown when any parameter is <c>null</c>.</exception> public static MacroStabilityInwardsWaternet CalculateDaily(IMacroStabilityInwardsWaternetInput input, IGeneralMacroStabilityInwardsWaternetInput generalInput) { if (input == null) { throw new ArgumentNullException(nameof(input)); } if (generalInput == null) { throw new ArgumentNullException(nameof(generalInput)); } IWaternetCalculator calculator = MacroStabilityInwardsCalculatorFactory.Instance .CreateWaternetDailyCalculator( CreateDailyCalculatorInput(input, generalInput), MacroStabilityInwardsKernelWrapperFactory.Instance); try { WaternetCalculatorResult result = calculator.Calculate(); return(MacroStabilityInwardsWaternetConverter.Convert(result)); } catch (WaternetCalculatorException) { return(new MacroStabilityInwardsWaternet(new MacroStabilityInwardsPhreaticLine[0], new MacroStabilityInwardsWaternetLine[0])); } }
public void Convert_WaternetCalculatorResultNull_ThrowsArgumentNullException() { // Call TestDelegate call = () => MacroStabilityInwardsWaternetConverter.Convert(null); // Assert var exception = Assert.Throws <ArgumentNullException>(call); Assert.AreEqual("calculatorResult", exception.ParamName); }
public void Convert_WithResult_ReturnMacroStabilityInwardsWaternet() { // Setup WaternetCalculatorResult result = WaternetCalculatorResultTestFactory.Create(); // Call MacroStabilityInwardsWaternet converted = MacroStabilityInwardsWaternetConverter.Convert(result); // Assert CalculatorOutputAssert.AssertWaternet(result, converted); }