public void Transform_ValidPreconsolidationStress_ReturnMacroStabilityInwardsPreconsolidationStress() { // Setup var random = new Random(21); var preconsolidationStress = new PreconsolidationStress { XCoordinate = random.NextDouble(), ZCoordinate = random.NextDouble(), StressDistributionType = 3, StressMean = random.NextDouble(), StressCoefficientOfVariation = random.NextDouble(), StressShift = 0 }; // Call MacroStabilityInwardsPreconsolidationStress transformedStress = MacroStabilityInwardsPreconsolidationStressTransformer.Transform(preconsolidationStress); // Assert Assert.AreEqual(preconsolidationStress.XCoordinate, transformedStress.Location.X); Assert.AreEqual(preconsolidationStress.ZCoordinate, transformedStress.Location.Y); VariationCoefficientLogNormalDistribution transformedPreconsolidationStressDistribution = transformedStress.Stress; Assert.AreEqual(preconsolidationStress.StressMean, transformedPreconsolidationStressDistribution.Mean, transformedPreconsolidationStressDistribution.GetAccuracy()); Assert.AreEqual(preconsolidationStress.StressCoefficientOfVariation, transformedPreconsolidationStressDistribution.CoefficientOfVariation, transformedPreconsolidationStressDistribution.GetAccuracy()); }
public void Transform_PreconsolidationStressNull_ThrowsArgumentNullException() { // Call TestDelegate call = () => MacroStabilityInwardsPreconsolidationStressTransformer.Transform(null); // Assert var exception = Assert.Throws <ArgumentNullException>(call); Assert.AreEqual("preconsolidationStress", exception.ParamName); }
public void Transform_PreconsolidationStressValuesNaN_ThrowsImportedDataTransformException( PreconsolidationStress preconsolidationStress) { // Call TestDelegate call = () => MacroStabilityInwardsPreconsolidationStressTransformer.Transform(preconsolidationStress); // Assert var exception = Assert.Throws <ImportedDataTransformException>(call); Exception innerException = exception.InnerException; Assert.IsInstanceOf <ArgumentException>(innerException); Assert.AreEqual(innerException.Message, exception.Message); }
public void Transform_InvalidPreconsolidationStressDistributionValues_ThrowsImportedDataTransformException(PreconsolidationStress preconsolidationStress) { // Call TestDelegate call = () => MacroStabilityInwardsPreconsolidationStressTransformer.Transform(preconsolidationStress); // Assert var exception = Assert.Throws <ImportedDataTransformException>(call); Exception innerException = exception.InnerException; Assert.IsInstanceOf <ArgumentOutOfRangeException>(innerException); var coordinate = new Point2D(preconsolidationStress.XCoordinate, preconsolidationStress.ZCoordinate); string expectedMessage = CreateExpectedErrorMessage(coordinate, innerException.Message); Assert.AreEqual(expectedMessage, exception.Message); }
public void Transform_InvalidStochasticDistributionShift_ThrowsImportedDataTransformException() { // Setup var random = new Random(21); var preconsolidationStress = new PreconsolidationStress { StressDistributionType = SoilLayerConstants.LogNormalDistributionValue, StressShift = random.NextDouble() }; // Call TestDelegate call = () => MacroStabilityInwardsPreconsolidationStressTransformer.Transform(preconsolidationStress); // Assert var exception = Assert.Throws <ImportedDataTransformException>(call); var coordinate = new Point2D(preconsolidationStress.XCoordinate, preconsolidationStress.ZCoordinate); string expectedMessage = CreateExpectedErrorMessage(coordinate, "Parameter moet lognormaal verdeeld zijn met een verschuiving gelijk aan 0."); Assert.AreEqual(expectedMessage, exception.Message); }