public void ValidateShiftedLogNormalDistribution_ValidDistribution_DoesNotThrowException() { // Setup const long distributionType = SoilLayerConstants.LogNormalDistributionValue; // Call TestDelegate call = () => DistributionHelper.ValidateShiftedLogNormalDistribution(distributionType); // Assert Assert.DoesNotThrow(call); }
public void ValidateShiftedLogNormalDistribution_InvalidDistributionType_ThrowsDistributionValidationException() { // Setup const long invalidDistributionType = -1; // Call TestDelegate call = () => DistributionHelper.ValidateShiftedLogNormalDistribution(invalidDistributionType); // Assert var exception = Assert.Throws <DistributionValidationException>(call); Assert.AreEqual("Parameter moet verschoven lognormaal verdeeld zijn.", exception.Message); }
/// <summary> /// Validates the distribution properties of a parameter which is defined as a /// log normal distribution. /// </summary> /// <param name="soilLayerName">The name of the soil layer.</param> /// <param name="distributionType">The distribution type of the parameter.</param> /// <param name="parameterName">The name of the parameter.</param> /// <exception cref="ImportedDataTransformException">Thrown when the distribution properties are invalid.</exception> private static void ValidateStochasticShiftedLogNormalDistributionParameter(string soilLayerName, long?distributionType, string parameterName) { try { DistributionHelper.ValidateShiftedLogNormalDistribution( distributionType); } catch (DistributionValidationException e) { string errorMessage = CreateErrorMessageForParameter(soilLayerName, parameterName, e.Message); throw new ImportedDataTransformException(errorMessage, e); } }