Index: src/Plugins/Ringtoets/Piping/src/Ringtoets.Piping.Calculation/Piping/PipingCalculation.cs =================================================================== diff -u -rf97b3a53c14de5e1f277fa6e94f3d40d3b81642c -re5a53456f16d530cb56abb35a256d8cf1f91df3d --- src/Plugins/Ringtoets/Piping/src/Ringtoets.Piping.Calculation/Piping/PipingCalculation.cs (.../PipingCalculation.cs) (revision f97b3a53c14de5e1f277fa6e94f3d40d3b81642c) +++ src/Plugins/Ringtoets/Piping/src/Ringtoets.Piping.Calculation/Piping/PipingCalculation.cs (.../PipingCalculation.cs) (revision e5a53456f16d530cb56abb35a256d8cf1f91df3d) @@ -55,18 +55,46 @@ /// public List Validate() { - List upliftCalculatorValidationResults = input.SurfaceLine != null ? - ValidateUpliftCalculator() : - new List(new[] - { - Resources.PipingCalculation_Validate_Lacks_surfaceline_uplift - }); + List soilProfileValidationResults = ValidateSoilProfile(); + List surfaceLineValidationResults = ValidateSurfaceLine(); + List upliftCalculatorValidationResults = new List(); + if (soilProfileValidationResults.Count == 0 && surfaceLineValidationResults.Count == 0) + { + upliftCalculatorValidationResults = ValidateUpliftCalculator(); + } List heaveCalculatorValidationResults = CreateHeaveCalculator().Validate(); List sellmeijerCalculatorValidationResults = CreateSellmeijerCalculator().Validate(); - return upliftCalculatorValidationResults.Concat(heaveCalculatorValidationResults).Concat(sellmeijerCalculatorValidationResults).ToList(); + return upliftCalculatorValidationResults + .Concat(surfaceLineValidationResults) + .Concat(soilProfileValidationResults) + .Concat(heaveCalculatorValidationResults) + .Concat(sellmeijerCalculatorValidationResults) + .ToList(); } + private List ValidateSurfaceLine() + { + var validationResults = new List(); + if (input.SurfaceLine == null) + { + validationResults.Add(Resources.PipingCalculation_Validate_Lacks_surfaceline_uplift); + + } + return validationResults; + } + + private List ValidateSoilProfile() + { + var validationResults = new List(); + if (input.SoilProfile == null) + { + validationResults.Add(Resources.PipingCalculation_Validate_Lacks_SoilProfile_Uplift); + + } + return validationResults; + } + private List ValidateUpliftCalculator() { try @@ -200,7 +228,7 @@ { ExitPointXCoordinate = input.ExitPointXCoordinate, PhreaticLevel = input.PhreaticLevelExit, - SoilProfile = PipingProfileCreator.Create(), + SoilProfile = PipingProfileCreator.Create(input.SoilProfile), SurfaceLine = PipingSurfaceLineCreator.Create(input.SurfaceLine), VolumicWeightOfWater = input.WaterVolumetricWeight }; Index: src/Plugins/Ringtoets/Piping/src/Ringtoets.Piping.Calculation/Piping/PipingCalculationInput.cs =================================================================== diff -u -r300a33d9acf653458b834b296becbf9ae552de8e -re5a53456f16d530cb56abb35a256d8cf1f91df3d --- src/Plugins/Ringtoets/Piping/src/Ringtoets.Piping.Calculation/Piping/PipingCalculationInput.cs (.../PipingCalculationInput.cs) (revision 300a33d9acf653458b834b296becbf9ae552de8e) +++ src/Plugins/Ringtoets/Piping/src/Ringtoets.Piping.Calculation/Piping/PipingCalculationInput.cs (.../PipingCalculationInput.cs) (revision e5a53456f16d530cb56abb35a256d8cf1f91df3d) @@ -30,6 +30,7 @@ private readonly double beddingAngle; private readonly double exitPointXCoordinate; private readonly RingtoetsPipingSurfaceLine surfaceLine; + private readonly PipingSoilProfile soilProfile; /// /// Constructs a new , which contains values for the parameters used @@ -58,7 +59,8 @@ /// The angle of the force balance representing the amount in which sand grains resist rolling. [°] /// The x coordinate of the exit point. [m] /// The surface line. - public PipingCalculationInput(double waterVolumetricWeight, double upliftModelFactor, double assessmentLevel, double piezometricHeadExit, double dampingFactorExit, double phreaticLevelExit, double piezometricHeadPolder, double criticalHeaveGradient, double thicknessCoverageLayer, double sellmeijerModelFactor, double sellmeijerReductionFactor, double seepageLength, double sandParticlesVolumicWeight, double whitesDragCoefficient, double diameter70, double darcyPermeability, double waterKinematicViscosity, double gravity, double thicknessAquiferLayer, double meanDiameter70, double beddingAngle, double exitPointXCoordinate, RingtoetsPipingSurfaceLine surfaceLine) + /// + public PipingCalculationInput(double waterVolumetricWeight, double upliftModelFactor, double assessmentLevel, double piezometricHeadExit, double dampingFactorExit, double phreaticLevelExit, double piezometricHeadPolder, double criticalHeaveGradient, double thicknessCoverageLayer, double sellmeijerModelFactor, double sellmeijerReductionFactor, double seepageLength, double sandParticlesVolumicWeight, double whitesDragCoefficient, double diameter70, double darcyPermeability, double waterKinematicViscosity, double gravity, double thicknessAquiferLayer, double meanDiameter70, double beddingAngle, double exitPointXCoordinate, RingtoetsPipingSurfaceLine surfaceLine, PipingSoilProfile soilProfile) { this.waterVolumetricWeight = waterVolumetricWeight; this.upliftModelFactor = upliftModelFactor; @@ -83,6 +85,7 @@ this.beddingAngle = beddingAngle; this.exitPointXCoordinate = exitPointXCoordinate; this.surfaceLine = surfaceLine; + this.soilProfile = soilProfile; } #region properties @@ -356,6 +359,17 @@ } } + /// + /// Gets the surface line. + /// + public PipingSoilProfile SoilProfile + { + get + { + return soilProfile; + } + } + #endregion } } \ No newline at end of file Index: src/Plugins/Ringtoets/Piping/src/Ringtoets.Piping.Calculation/Piping/PipingProfileCreator.cs =================================================================== diff -u -r300a33d9acf653458b834b296becbf9ae552de8e -re5a53456f16d530cb56abb35a256d8cf1f91df3d --- src/Plugins/Ringtoets/Piping/src/Ringtoets.Piping.Calculation/Piping/PipingProfileCreator.cs (.../PipingProfileCreator.cs) (revision 300a33d9acf653458b834b296becbf9ae552de8e) +++ src/Plugins/Ringtoets/Piping/src/Ringtoets.Piping.Calculation/Piping/PipingProfileCreator.cs (.../PipingProfileCreator.cs) (revision e5a53456f16d530cb56abb35a256d8cf1f91df3d) @@ -1,4 +1,8 @@ -using Deltares.WTIPiping; +using System; +using System.Linq; +using Deltares.WTIPiping; +using Ringtoets.Piping.Calculation.Properties; +using Ringtoets.Piping.Data; namespace Ringtoets.Piping.Calculation.Piping { @@ -7,20 +11,48 @@ /// internal static class PipingProfileCreator { + private const bool dSoilModelDatabaseContainsAquiferOnLayerLevel = false; + /// /// Creates a simple with a single default constructed . /// + /// /// - public static PipingProfile Create() + public static PipingProfile Create(PipingSoilProfile soilProfile) { - var profile = new PipingProfile(); - var layer = new PipingLayer + ValidateForAquiferLayer(soilProfile); + var profile = new PipingProfile { - IsAquifer = true + BottomLevel = soilProfile.Bottom }; - profile.Layers.Add(layer); + foreach (PipingSoilLayer layer in soilProfile.Layers.OrderByDescending(l => l.Top)) + { + profile.Layers.Add(new PipingLayer + { + TopLevel = layer.Top + }); + } + var max = profile.Layers.Max(l => l.TopLevel); + var topLayer = profile.Layers.FirstOrDefault(l => Math.Abs(l.TopLevel - max) < 1e-6); + if (topLayer != null) + { + topLayer.IsAquifer = true; + } return profile; } + + private static void ValidateForAquiferLayer(PipingSoilProfile soilProfile) + { + if (!soilProfile.Layers.Any(l => l.IsAquifer)) + { + if (dSoilModelDatabaseContainsAquiferOnLayerLevel) + { + var message = String.Format(Resources.PipingProfileCreator_NoAquiferLayer, soilProfile.Name); + throw new PipingProfileCreatorException(message); + } + soilProfile.Layers.First().IsAquifer = true; + } + } } } \ No newline at end of file Index: src/Plugins/Ringtoets/Piping/src/Ringtoets.Piping.Calculation/Piping/PipingProfileCreatorException.cs =================================================================== diff -u --- src/Plugins/Ringtoets/Piping/src/Ringtoets.Piping.Calculation/Piping/PipingProfileCreatorException.cs (revision 0) +++ src/Plugins/Ringtoets/Piping/src/Ringtoets.Piping.Calculation/Piping/PipingProfileCreatorException.cs (revision e5a53456f16d530cb56abb35a256d8cf1f91df3d) @@ -0,0 +1,36 @@ +using System; + +namespace Ringtoets.Piping.Calculation.Piping +{ + /// + /// Exception thrown when something went wrong in the + /// + public class PipingProfileCreatorException : Exception + { + /// + /// Initializes a new instance of the class. + /// + public PipingProfileCreatorException() + { + } + + /// + /// Initializes a new instance of the class + /// with a specified error message. + /// + /// The message that describes the error. + public PipingProfileCreatorException(string message) + : base(message) + { + } + + /// + /// Initializes a new instance of the class with + /// a specified error message and a reference to the inner exception that is the cause of this exception. + /// + /// The error message that explains the reason for the exception. + /// The exception that is the cause of the current exception, or a + /// null reference if no inner exception is specified. + public PipingProfileCreatorException(string message, Exception innerException) : base(message, innerException) { } + } +} \ No newline at end of file Index: src/Plugins/Ringtoets/Piping/src/Ringtoets.Piping.Calculation/Properties/Resources.Designer.cs =================================================================== diff -u -r300a33d9acf653458b834b296becbf9ae552de8e -re5a53456f16d530cb56abb35a256d8cf1f91df3d --- src/Plugins/Ringtoets/Piping/src/Ringtoets.Piping.Calculation/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 300a33d9acf653458b834b296becbf9ae552de8e) +++ src/Plugins/Ringtoets/Piping/src/Ringtoets.Piping.Calculation/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision e5a53456f16d530cb56abb35a256d8cf1f91df3d) @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.18444 +// Runtime Version:4.0.30319.34209 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -61,6 +61,15 @@ } /// + /// Looks up a localized string similar to Een ondergrondprofiel moet geselecteerd zijn om een Uplift berekening uit te kunnen voeren.. + /// + internal static string PipingCalculation_Validate_Lacks_SoilProfile_Uplift { + get { + return ResourceManager.GetString("PipingCalculation_Validate_Lacks_SoilProfile_Uplift", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Een dwarsdoorsnede moet geselecteerd zijn om een Uplift berekening uit te kunnen voeren.. /// internal static string PipingCalculation_Validate_Lacks_surfaceline_uplift { @@ -70,11 +79,11 @@ } /// - /// Looks up a localized string similar to . + /// Looks up a localized string similar to Het profiel '{0}' bevat geen waterdoorlatende laag.. /// - internal static string String1 { + internal static string PipingProfileCreator_NoAquiferLayer { get { - return ResourceManager.GetString("String1", resourceCulture); + return ResourceManager.GetString("PipingProfileCreator_NoAquiferLayer", resourceCulture); } } } Index: src/Plugins/Ringtoets/Piping/src/Ringtoets.Piping.Calculation/Properties/Resources.resx =================================================================== diff -u -r0cc887bb46e8cd47745f5743311902faa4c6bc87 -re5a53456f16d530cb56abb35a256d8cf1f91df3d --- src/Plugins/Ringtoets/Piping/src/Ringtoets.Piping.Calculation/Properties/Resources.resx (.../Resources.resx) (revision 0cc887bb46e8cd47745f5743311902faa4c6bc87) +++ src/Plugins/Ringtoets/Piping/src/Ringtoets.Piping.Calculation/Properties/Resources.resx (.../Resources.resx) (revision e5a53456f16d530cb56abb35a256d8cf1f91df3d) @@ -117,10 +117,13 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - + + Een ondergrondprofiel moet geselecteerd zijn om een Uplift berekening uit te kunnen voeren. Een dwarsdoorsnede moet geselecteerd zijn om een Uplift berekening uit te kunnen voeren. + + Het profiel '{0}' bevat geen waterdoorlatende laag. + \ No newline at end of file Index: src/Plugins/Ringtoets/Piping/src/Ringtoets.Piping.Calculation/Ringtoets.Piping.Calculation.csproj =================================================================== diff -u -r7e0c1db9982e81638603275bb2b15083757330ef -re5a53456f16d530cb56abb35a256d8cf1f91df3d --- src/Plugins/Ringtoets/Piping/src/Ringtoets.Piping.Calculation/Ringtoets.Piping.Calculation.csproj (.../Ringtoets.Piping.Calculation.csproj) (revision 7e0c1db9982e81638603275bb2b15083757330ef) +++ src/Plugins/Ringtoets/Piping/src/Ringtoets.Piping.Calculation/Ringtoets.Piping.Calculation.csproj (.../Ringtoets.Piping.Calculation.csproj) (revision e5a53456f16d530cb56abb35a256d8cf1f91df3d) @@ -22,7 +22,8 @@ false prompt MinimumRecommendedRules.ruleset - + + bin\Release\ @@ -33,7 +34,8 @@ x86 prompt MinimumRecommendedRules.ruleset - + + @@ -56,6 +58,7 @@ + Index: src/Plugins/Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingFailureMechanism.cs =================================================================== diff -u -rb02b755bf5d7a52b44deb11bdb9b1e70789306a0 -re5a53456f16d530cb56abb35a256d8cf1f91df3d --- src/Plugins/Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingFailureMechanism.cs (.../PipingFailureMechanism.cs) (revision b02b755bf5d7a52b44deb11bdb9b1e70789306a0) +++ src/Plugins/Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingFailureMechanism.cs (.../PipingFailureMechanism.cs) (revision e5a53456f16d530cb56abb35a256d8cf1f91df3d) @@ -31,7 +31,7 @@ /// /// Gets the available profiles within the scope of the piping failure mechanism. /// - public IEnumerable SoilProfiles { get; private set; } + public IEnumerable SoilProfiles { get; private set; } /// /// Gets all available piping calculations. Index: src/Plugins/Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingSoilLayer.cs =================================================================== diff -u -r300a33d9acf653458b834b296becbf9ae552de8e -re5a53456f16d530cb56abb35a256d8cf1f91df3d --- src/Plugins/Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingSoilLayer.cs (.../PipingSoilLayer.cs) (revision 300a33d9acf653458b834b296becbf9ae552de8e) +++ src/Plugins/Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingSoilLayer.cs (.../PipingSoilLayer.cs) (revision e5a53456f16d530cb56abb35a256d8cf1f91df3d) @@ -8,5 +8,6 @@ } public double Top { get; private set; } + public bool IsAquifer { get; set; } } } \ No newline at end of file Index: src/Plugins/Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingSoilProfile.cs =================================================================== diff -u -r300a33d9acf653458b834b296becbf9ae552de8e -re5a53456f16d530cb56abb35a256d8cf1f91df3d --- src/Plugins/Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingSoilProfile.cs (.../PipingSoilProfile.cs) (revision 300a33d9acf653458b834b296becbf9ae552de8e) +++ src/Plugins/Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingSoilProfile.cs (.../PipingSoilProfile.cs) (revision e5a53456f16d530cb56abb35a256d8cf1f91df3d) @@ -55,5 +55,10 @@ layers = value.ToArray(); } } + + public override string ToString() + { + return Name; + } } } \ No newline at end of file Index: src/Plugins/Ringtoets/Piping/src/Ringtoets.Piping.Forms/NodePresenters/PipingFailureMechanismNodePresenter.cs =================================================================== diff -u -r617e40b29b2e1f5b5d2ad5abaeb4c6ad8ccffee4 -re5a53456f16d530cb56abb35a256d8cf1f91df3d --- src/Plugins/Ringtoets/Piping/src/Ringtoets.Piping.Forms/NodePresenters/PipingFailureMechanismNodePresenter.cs (.../PipingFailureMechanismNodePresenter.cs) (revision 617e40b29b2e1f5b5d2ad5abaeb4c6ad8ccffee4) +++ src/Plugins/Ringtoets/Piping/src/Ringtoets.Piping.Forms/NodePresenters/PipingFailureMechanismNodePresenter.cs (.../PipingFailureMechanismNodePresenter.cs) (revision e5a53456f16d530cb56abb35a256d8cf1f91df3d) @@ -43,7 +43,8 @@ yield return new PipingCalculationInputs { PipingData = calculation, - AvailablePipingSurfaceLines = failureMechanism.SurfaceLines + AvailablePipingSurfaceLines = failureMechanism.SurfaceLines, + AvailablePipingSoilProfiles = failureMechanism.SoilProfiles }; } } Index: src/Plugins/Ringtoets/Piping/src/Ringtoets.Piping.IO/PipingSoilProfileReader.cs =================================================================== diff -u -r92ea66818567a23223b31d658ef8db3349f9e8f0 -re5a53456f16d530cb56abb35a256d8cf1f91df3d --- src/Plugins/Ringtoets/Piping/src/Ringtoets.Piping.IO/PipingSoilProfileReader.cs (.../PipingSoilProfileReader.cs) (revision 92ea66818567a23223b31d658ef8db3349f9e8f0) +++ src/Plugins/Ringtoets/Piping/src/Ringtoets.Piping.IO/PipingSoilProfileReader.cs (.../PipingSoilProfileReader.cs) (revision e5a53456f16d530cb56abb35a256d8cf1f91df3d) @@ -113,7 +113,8 @@ private PipingSoilLayer ReadPipingSoilLayer() { var columnValue = (double) dataReader[topColumn]; - return new PipingSoilLayer(columnValue); + var pipingSoilLayer = new PipingSoilLayer(columnValue); + return pipingSoilLayer; } public void Dispose() Index: src/Plugins/Ringtoets/Piping/src/Ringtoets.Piping.Service/PipingCalculationService.cs =================================================================== diff -u -r7b2fb7be49ba189d624e933485f14a7b94039bbb -re5a53456f16d530cb56abb35a256d8cf1f91df3d --- src/Plugins/Ringtoets/Piping/src/Ringtoets.Piping.Service/PipingCalculationService.cs (.../PipingCalculationService.cs) (revision 7b2fb7be49ba189d624e933485f14a7b94039bbb) +++ src/Plugins/Ringtoets/Piping/src/Ringtoets.Piping.Service/PipingCalculationService.cs (.../PipingCalculationService.cs) (revision e5a53456f16d530cb56abb35a256d8cf1f91df3d) @@ -120,7 +120,8 @@ pipingData.MeanDiameter70, pipingData.BeddingAngle, pipingData.ExitPointXCoordinate, - pipingData.SurfaceLine + pipingData.SurfaceLine, + pipingData.SoilProfile ); } Index: src/Plugins/Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/Piping/PipingCalculationInputTest.cs =================================================================== diff -u -r300a33d9acf653458b834b296becbf9ae552de8e -re5a53456f16d530cb56abb35a256d8cf1f91df3d --- src/Plugins/Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/Piping/PipingCalculationInputTest.cs (.../PipingCalculationInputTest.cs) (revision 300a33d9acf653458b834b296becbf9ae552de8e) +++ src/Plugins/Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/Piping/PipingCalculationInputTest.cs (.../PipingCalculationInputTest.cs) (revision e5a53456f16d530cb56abb35a256d8cf1f91df3d) @@ -36,6 +36,10 @@ double beddingAngleValue = random.NextDouble(); double exitPointXCoordinate = random.NextDouble(); var surfaceLine = new RingtoetsPipingSurfaceLine(); + var soilProfile = new PipingSoilProfile(string.Empty, random.NextDouble(), new [] + { + new PipingSoilLayer(random.NextDouble()), + }); var input = new PipingCalculationInput( volumetricWeightOfWaterValue, @@ -60,7 +64,8 @@ meanDiameter70Value, beddingAngleValue, exitPointXCoordinate, - surfaceLine); + surfaceLine, + soilProfile); Assert.AreEqual(volumetricWeightOfWaterValue, input.WaterVolumetricWeight); Assert.AreEqual(modelFactorUpliftValue, input.UpliftModelFactor); @@ -85,6 +90,7 @@ Assert.AreEqual(beddingAngleValue, input.BeddingAngle); Assert.AreEqual(exitPointXCoordinate, input.ExitPointXCoordinate); Assert.AreSame(surfaceLine, input.SurfaceLine); + Assert.AreSame(soilProfile, input.SoilProfile); } } } \ No newline at end of file Index: src/Plugins/Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/Piping/PipingCalculationTest.cs =================================================================== diff -u -r300a33d9acf653458b834b296becbf9ae552de8e -re5a53456f16d530cb56abb35a256d8cf1f91df3d --- src/Plugins/Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/Piping/PipingCalculationTest.cs (.../PipingCalculationTest.cs) (revision 300a33d9acf653458b834b296becbf9ae552de8e) +++ src/Plugins/Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/Piping/PipingCalculationTest.cs (.../PipingCalculationTest.cs) (revision e5a53456f16d530cb56abb35a256d8cf1f91df3d) @@ -11,7 +11,7 @@ public class PipingCalculationTest { [Test] - public void GivenACompleteInput_WhenCalculationPerformed_ThenResultContainsNoNaN() + public void Calculate_CompleteValidInput_ReturnsResultWithNoNaN() { PipingCalculationInput input = new TestPipingInput().AsRealInput(); @@ -27,6 +27,20 @@ } [Test] + public void Validate_CompleteValidInput_ReturnsNoValidationMessages() + { + // Setup + PipingCalculationInput input = new TestPipingInput().AsRealInput(); + var calculation = new PipingCalculation(input); + + // Call + List validationMessages = calculation.Validate(); + + // Assert + Assert.AreEqual(0, validationMessages.Count); + } + + [Test] [TestCase(0)] [TestCase(-1e-6)] [TestCase(-100)] @@ -236,6 +250,25 @@ } [Test] + public void Validate_NoSoilProfileSet_ValidationMessageForHavingNoSoilProfileSelected() + { + // Setup + PipingCalculationInput input = new TestPipingInput + { + SoilProfile = null, + }.AsRealInput(); + + var calculation = new PipingCalculation(input); + + // Call + List validationMessages = calculation.Validate(); + + // Assert + Assert.AreEqual(1, validationMessages.Count); + Assert.AreEqual("Een ondergrondprofiel moet geselecteerd zijn om een Uplift berekening uit te kunnen voeren.", validationMessages[0]); + } + + [Test] public void Validate_AssessmentLevelPhreaticLevelExitSellmeijerReductionFactorThicknessCoverageLayerZero_ValidationMessageForHRiverHExitRcDTotalAndDTotal() { // Setup Index: src/Plugins/Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/Piping/PipingProfileCreatorExceptionTest.cs =================================================================== diff -u --- src/Plugins/Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/Piping/PipingProfileCreatorExceptionTest.cs (revision 0) +++ src/Plugins/Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/Piping/PipingProfileCreatorExceptionTest.cs (revision e5a53456f16d530cb56abb35a256d8cf1f91df3d) @@ -0,0 +1,53 @@ +using System; +using NUnit.Framework; + +using Ringtoets.Piping.Calculation.Piping; + +namespace Ringtoets.Piping.Calculation.Test.Piping +{ + public class PipingProfileCreatorExceptionTest + { + [Test] + public void DefaultConstructor_InnerExceptionNullAndMessageDefault() + { + // Setup + var expectedMessage = String.Format("Exception of type '{0}' was thrown.", typeof(PipingProfileCreatorException).FullName); + + // Call + var exception = new PipingProfileCreatorException(); + + // Assert + Assert.IsNull(exception.InnerException); + Assert.AreEqual(expectedMessage, exception.Message); + } + + [Test] + public void Constructor_WithCustomMessage_InnerExceptionNullAndMessageSetToCustom() + { + // Setup + var expectedMessage ="Some exception message"; + + // Call + var exception = new PipingProfileCreatorException(expectedMessage); + + // Assert + Assert.IsNull(exception.InnerException); + Assert.AreEqual(expectedMessage, exception.Message); + } + + [Test] + public void Constructor_WithCustomMessageAndInnerException_InnerExceptionSetAndMessageSetToCustom() + { + // Setup + var expectedMessage = "Some exception message"; + var expectedInnerException = new Exception(); + + // Call + var exception = new PipingProfileCreatorException(expectedMessage, expectedInnerException); + + // Assert + Assert.AreSame(expectedInnerException, exception.InnerException); + Assert.AreEqual(expectedMessage, exception.Message); + } + } +} \ No newline at end of file Index: src/Plugins/Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/Piping/PipingProfileCreatorTest.cs =================================================================== diff -u -r300a33d9acf653458b834b296becbf9ae552de8e -re5a53456f16d530cb56abb35a256d8cf1f91df3d --- src/Plugins/Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/Piping/PipingProfileCreatorTest.cs (.../PipingProfileCreatorTest.cs) (revision 300a33d9acf653458b834b296becbf9ae552de8e) +++ src/Plugins/Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/Piping/PipingProfileCreatorTest.cs (.../PipingProfileCreatorTest.cs) (revision e5a53456f16d530cb56abb35a256d8cf1f91df3d) @@ -1,22 +1,109 @@ -using Deltares.WTIPiping; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using Deltares.WTIPiping; using NUnit.Framework; using Ringtoets.Piping.Calculation.Piping; +using Ringtoets.Piping.Data; namespace Ringtoets.Piping.Calculation.Test.Piping { public class PipingProfileCreatorTest { [Test] - public void Create_Always_ReturnsProfileWithSingleAquiferLayer() + public void Create_ProfileWithOneLayer_ReturnsProfileWithSingleLayer() { + // Setup + var random = new Random(22); + var expectedTop = random.NextDouble(); + var expectedBottom = random.NextDouble(); + IEnumerable layers = new [] + { + new PipingSoilLayer(expectedTop), + }; + var soilProfile = new PipingSoilProfile(String.Empty, expectedBottom, layers); + // Call - PipingProfile actual = PipingProfileCreator.Create(); + PipingProfile actual = PipingProfileCreator.Create(soilProfile); // Assert Assert.IsNotNull(actual.Layers); + Assert.IsNotNull(actual.BottomAquiferLayer); + Assert.IsNotNull(actual.TopAquiferLayer); Assert.AreEqual(1, actual.Layers.Count); - Assert.IsTrue(actual.Layers[0].IsAquifer); + Assert.IsTrue(actual.Layers.First(l => Math.Abs(l.TopLevel - actual.Layers.Max(ll => ll.TopLevel)) < 1e-6).IsAquifer); + Assert.AreEqual(expectedTop, actual.Layers[0].TopLevel); + Assert.AreEqual(expectedTop, actual.TopLevel); + Assert.AreEqual(expectedBottom, actual.BottomLevel); } + + [Test] + public void Create_ProfileWithMultipleLayers_ReturnsProfileWithMultipleLayers() + { + // Setup + var random = new Random(22); + var expectedTopA = random.NextDouble(); + var expectedTopB = random.NextDouble() + expectedTopA; + var expectedTopC = random.NextDouble() + expectedTopB; + var expectedBottom = random.NextDouble(); + IEnumerable layers = new[] + { + new PipingSoilLayer(expectedTopA), + new PipingSoilLayer(expectedTopB), + new PipingSoilLayer(expectedTopC) + }; + var soilProfile = new PipingSoilProfile(String.Empty, expectedBottom, layers); + + // Call + PipingProfile actual = PipingProfileCreator.Create(soilProfile); + + // Assert + Assert.AreEqual(3, actual.Layers.Count); + IEnumerable expectedAquifers = new[] + { + true, + false, + false, + + }; + CollectionAssert.AreEqual(expectedAquifers, actual.Layers.Select(l => l.IsAquifer)); + CollectionAssert.AreEqual(new []{ expectedTopC, expectedTopB, expectedTopA }, actual.Layers.Select(l => l.TopLevel)); + Assert.AreEqual(expectedBottom, actual.BottomLevel); + } + + [Test] + public void Create_ProfileWithDecreasingTops_ReturnsProfileWithSingleLayer() + { + // Setup + var random = new Random(22); + var expectedTopA = random.NextDouble(); + var expectedTopB = expectedTopA - random.NextDouble(); + var expectedTopC = expectedTopB - random.NextDouble(); + var expectedBottom = random.NextDouble(); + IEnumerable layers = new[] + { + new PipingSoilLayer(expectedTopA), + new PipingSoilLayer(expectedTopB), + new PipingSoilLayer(expectedTopC) + }; + var soilProfile = new PipingSoilProfile(String.Empty, expectedBottom, layers); + + // Call + PipingProfile actual = PipingProfileCreator.Create(soilProfile); + + // Assert + Assert.AreEqual(3, actual.Layers.Count); + IEnumerable expectedAquifers = new[] + { + true, + false, + false, + }; + CollectionAssert.AreEqual(expectedAquifers, actual.Layers.Select(l => l.IsAquifer)); + CollectionAssert.AreEqual(new[] { expectedTopA, expectedTopB, expectedTopC }, actual.Layers.Select(l => l.TopLevel)); + Assert.AreEqual(expectedBottom, actual.BottomLevel); + } } } \ No newline at end of file Index: src/Plugins/Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/Ringtoets.Piping.Calculation.Test.csproj =================================================================== diff -u -r300a33d9acf653458b834b296becbf9ae552de8e -re5a53456f16d530cb56abb35a256d8cf1f91df3d --- src/Plugins/Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/Ringtoets.Piping.Calculation.Test.csproj (.../Ringtoets.Piping.Calculation.Test.csproj) (revision 300a33d9acf653458b834b296becbf9ae552de8e) +++ src/Plugins/Ringtoets/Piping/test/Ringtoets.Piping.Calculation.Test/Ringtoets.Piping.Calculation.Test.csproj (.../Ringtoets.Piping.Calculation.Test.csproj) (revision e5a53456f16d530cb56abb35a256d8cf1f91df3d) @@ -43,6 +43,7 @@ + Index: src/Plugins/Ringtoets/Piping/test/Ringtoets.Piping.Calculation.TestUtil/TestPipingInput.cs =================================================================== diff -u -r300a33d9acf653458b834b296becbf9ae552de8e -re5a53456f16d530cb56abb35a256d8cf1f91df3d --- src/Plugins/Ringtoets/Piping/test/Ringtoets.Piping.Calculation.TestUtil/TestPipingInput.cs (.../TestPipingInput.cs) (revision 300a33d9acf653458b834b296becbf9ae552de8e) +++ src/Plugins/Ringtoets/Piping/test/Ringtoets.Piping.Calculation.TestUtil/TestPipingInput.cs (.../TestPipingInput.cs) (revision e5a53456f16d530cb56abb35a256d8cf1f91df3d) @@ -30,6 +30,7 @@ public double MeanDiameter70; public double ThicknessAquiferLayer; public RingtoetsPipingSurfaceLine SurfaceLine; + public PipingSoilProfile SoilProfile; private readonly Random random = new Random(22); private double last; @@ -59,11 +60,40 @@ MeanDiameter70 = NextIncrementalDouble(); ThicknessAquiferLayer = NextIncrementalDouble(); SurfaceLine = CreateValidSurfaceLine(); + SoilProfile = CreateValidSoilProfile(); } + private PipingSoilProfile CreateValidSoilProfile() + { + return new PipingSoilProfile(String.Empty, -2, new [] + { + new PipingSoilLayer(9), + new PipingSoilLayer(2), + new PipingSoilLayer(-1), + }); + } + private RingtoetsPipingSurfaceLine CreateValidSurfaceLine() { - return new RingtoetsPipingSurfaceLine(); + var ringtoetsPipingSurfaceLine = new RingtoetsPipingSurfaceLine(); + ringtoetsPipingSurfaceLine.SetGeometry(new[] + { + new Point3D + { + X = 0, Y = 0, Z = 2 + }, + new Point3D + { + X = 1, Y = 0, Z = 8 + + }, + new Point3D + { + X = 2, Y = 0, Z = -1 + + } + }); + return ringtoetsPipingSurfaceLine; } /// @@ -102,8 +132,8 @@ MeanDiameter70, BeddingAngle, ExitPointXCoordinate, - SurfaceLine - ); + SurfaceLine, + SoilProfile); } } } \ No newline at end of file Index: src/Plugins/Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingDataTest.cs =================================================================== diff -u -r308703c02f5602704483e204ad9a475d90eece69 -re5a53456f16d530cb56abb35a256d8cf1f91df3d --- src/Plugins/Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingDataTest.cs (.../PipingDataTest.cs) (revision 308703c02f5602704483e204ad9a475d90eece69) +++ src/Plugins/Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingDataTest.cs (.../PipingDataTest.cs) (revision e5a53456f16d530cb56abb35a256d8cf1f91df3d) @@ -38,6 +38,7 @@ Assert.AreEqual(0, defaultConstructed.ThicknessAquiferLayer); Assert.AreEqual(0, defaultConstructed.DarcyPermeability); Assert.IsNull(defaultConstructed.SurfaceLine); + Assert.IsNull(defaultConstructed.SoilProfile); Assert.AreEqual(1.0, defaultConstructed.DampingFactorExit); Assert.AreEqual(0.3, defaultConstructed.SellmeijerReductionFactor); Index: src/Plugins/Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/NodePresenters/PipingCalculationInputsNodePresenterTest.cs =================================================================== diff -u -r308703c02f5602704483e204ad9a475d90eece69 -re5a53456f16d530cb56abb35a256d8cf1f91df3d --- src/Plugins/Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/NodePresenters/PipingCalculationInputsNodePresenterTest.cs (.../PipingCalculationInputsNodePresenterTest.cs) (revision 308703c02f5602704483e204ad9a475d90eece69) +++ src/Plugins/Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/NodePresenters/PipingCalculationInputsNodePresenterTest.cs (.../PipingCalculationInputsNodePresenterTest.cs) (revision e5a53456f16d530cb56abb35a256d8cf1f91df3d) @@ -45,9 +45,8 @@ // Setup const string nodeName = ""; - var mocks = new MockRepository(); - var pipingNode = mocks.Stub(); - mocks.ReplayAll(); + var pipingNode = mockRepository.Stub(); + mockRepository.ReplayAll(); var nodePresenter = new PipingCalculationInputsNodePresenter(); @@ -73,9 +72,8 @@ public void GetChildNodeObjects_WithOutputData_ReturnOutputChildNode() { // Setup - var mocks = new MockRepository(); - var nodeMock = mocks.StrictMock(); - mocks.ReplayAll(); + var nodeMock = mockRepository.StrictMock(); + mockRepository.ReplayAll(); var nodePresenter = new PipingCalculationInputsNodePresenter(); @@ -93,16 +91,15 @@ // Assert Assert.AreEqual(1, children.Count()); CollectionAssert.AllItemsAreInstancesOfType(children, typeof(PipingOutput)); - mocks.VerifyAll(); // Expect no calls on tree node + mockRepository.VerifyAll(); // Expect no calls on tree node } [Test] public void GetChildNodeObjects_WithoutOutput_ReturnNoChildNodes() { // Setup - var mocks = new MockRepository(); - var nodeMock = mocks.StrictMock(); - mocks.ReplayAll(); + var nodeMock = mockRepository.StrictMock(); + mockRepository.ReplayAll(); var nodePresenter = new PipingCalculationInputsNodePresenter(); @@ -116,16 +113,15 @@ // Assert Assert.AreEqual(0, children.Count()); - mocks.VerifyAll(); // Expect no calls on tree node + mockRepository.VerifyAll(); // Expect no calls on tree node } [Test] public void CanRenameNode_Always_ReturnTrue() { // Setup - var mocks = new MockRepository(); - var nodeMock = mocks.StrictMock(); - mocks.ReplayAll(); + var nodeMock = mockRepository.StrictMock(); + mockRepository.ReplayAll(); var nodePresenter = new PipingCalculationInputsNodePresenter(); @@ -134,16 +130,15 @@ // Assert Assert.IsTrue(renameAllowed); - mocks.VerifyAll(); // Expect no calls on tree node + mockRepository.VerifyAll(); // Expect no calls on tree node } [Test] public void CanRenameNodeTo_Always_ReturnTrue() { // Setup - var mocks = new MockRepository(); - var nodeMock = mocks.StrictMock(); - mocks.ReplayAll(); + var nodeMock = mockRepository.StrictMock(); + mockRepository.ReplayAll(); var nodePresenter = new PipingCalculationInputsNodePresenter(); @@ -152,17 +147,16 @@ // Assert Assert.IsTrue(renameAllowed); - mocks.ReplayAll(); // Expect no calls on tree node + mockRepository.ReplayAll(); // Expect no calls on tree node } [Test] public void OnNodeRenamed_Always_SetNewNameToPipingData() { // Setup - var mocks = new MockRepository(); - var observerMock = mocks.StrictMock(); + var observerMock = mockRepository.StrictMock(); observerMock.Expect(o => o.UpdateObserver()); - mocks.ReplayAll(); + mockRepository.ReplayAll(); var pipingData = new PipingData { @@ -182,33 +176,31 @@ // Assert Assert.AreEqual(newName, pipingData.Name); - mocks.VerifyAll(); + mockRepository.VerifyAll(); } [Test] public void OnNodeChecked_Always_DoNothing() { // Setup - var mocks = new MockRepository(); - var nodeMock = mocks.StrictMock(); - mocks.ReplayAll(); + var nodeMock = mockRepository.StrictMock(); + mockRepository.ReplayAll(); var nodePresenter = new PipingCalculationInputsNodePresenter(); // Call nodePresenter.OnNodeChecked(nodeMock); // Assert - mocks.VerifyAll(); // Expect no calls on tree node + mockRepository.VerifyAll(); // Expect no calls on tree node } [Test] public void CanDrag_Always_ReturnNone() { // Setup - var mocks = new MockRepository(); - var dataMock = mocks.StrictMock(); - mocks.ReplayAll(); + var dataMock = mockRepository.StrictMock(); + mockRepository.ReplayAll(); var nodePresenter = new PipingCalculationInputsNodePresenter(); @@ -217,18 +209,17 @@ // Assert Assert.AreEqual(DragOperations.None, dragAllowed); - mocks.VerifyAll(); + mockRepository.VerifyAll(); } [Test] public void CanDrop_Always_ReturnNone() { // Setup - var mocks = new MockRepository(); - var dataMock = mocks.StrictMock(); - var sourceMock = mocks.StrictMock(); - var targetMock = mocks.StrictMock(); - mocks.ReplayAll(); + var dataMock = mockRepository.StrictMock(); + var sourceMock = mockRepository.StrictMock(); + var targetMock = mockRepository.StrictMock(); + mockRepository.ReplayAll(); var nodePresenter = new PipingCalculationInputsNodePresenter(); @@ -237,18 +228,17 @@ // Assert Assert.AreEqual(DragOperations.None, dropAllowed); - mocks.VerifyAll(); // Expect no calls on mocks. + mockRepository.VerifyAll(); // Expect no calls on mockRepository. } [Test] public void CanInsert_Always_ReturnFalse() { // Setup - var mocks = new MockRepository(); - var dataMock = mocks.StrictMock(); - var sourceMock = mocks.StrictMock(); - var targetMock = mocks.StrictMock(); - mocks.ReplayAll(); + var dataMock = mockRepository.StrictMock(); + var sourceMock = mockRepository.StrictMock(); + var targetMock = mockRepository.StrictMock(); + mockRepository.ReplayAll(); var nodePresenter = new PipingCalculationInputsNodePresenter(); @@ -257,56 +247,53 @@ // Assert Assert.IsFalse(insertionAllowed); - mocks.VerifyAll(); // Expect no calls on arguments + mockRepository.VerifyAll(); // Expect no calls on arguments } [Test] public void OnDragDrop_Always_DoNothing() { // Setup - var mocks = new MockRepository(); - var dataMock = mocks.StrictMock(); - var sourceParentNodeMock = mocks.StrictMock(); - var targetParentNodeDataMock = mocks.StrictMock(); - mocks.ReplayAll(); + var dataMock = mockRepository.StrictMock(); + var sourceParentNodeMock = mockRepository.StrictMock(); + var targetParentNodeDataMock = mockRepository.StrictMock(); + mockRepository.ReplayAll(); var nodePresenter = new PipingCalculationInputsNodePresenter(); // Call nodePresenter.OnDragDrop(dataMock, sourceParentNodeMock, targetParentNodeDataMock, DragOperations.Move, 2); // Assert - mocks.VerifyAll(); // Expect no calls on arguments + mockRepository.VerifyAll(); // Expect no calls on arguments } [Test] public void OnNodeSelected_Always_DoNothing() { // Setup - var mocks = new MockRepository(); - var dataMock = mocks.StrictMock(); - mocks.ReplayAll(); + var dataMock = mockRepository.StrictMock(); + mockRepository.ReplayAll(); var nodePresenter = new PipingCalculationInputsNodePresenter(); // Call nodePresenter.OnNodeSelected(dataMock); // Assert - mocks.VerifyAll(); // Expect no calls on arguments + mockRepository.VerifyAll(); // Expect no calls on arguments } [Test] public void GetContextMenu_Always_ContextMenuWithOneItemForCalculate() { // Setup - var mocks = new MockRepository(); - var nodeMock = mocks.StrictMock(); - var dataMock = mocks.StrictMock(); + var nodeMock = mockRepository.StrictMock(); + var dataMock = mockRepository.StrictMock(); var nodePresenter = new PipingCalculationInputsNodePresenter(); - mocks.ReplayAll(); + mockRepository.ReplayAll(); // Call var contextMenu = nodePresenter.GetContextMenu(nodeMock, dataMock); @@ -317,54 +304,51 @@ Assert.AreEqual(WtiFormsResources.PipingDataContextMenuCalculate, contextMenu.Items[1].Text); Assert.AreEqual(WtiFormsResources.PipingDataContextMenuValidate, contextMenu.Items[0].Text); Assert.IsInstanceOf(contextMenu); - mocks.VerifyAll(); // Expect no calls on arguments + mockRepository.VerifyAll(); // Expect no calls on arguments } [Test] public void OnPropertyChange_Always_DoNothing() { // Setup - var mocks = new MockRepository(); - var dataMock = mocks.StrictMock(); - var nodeMock = mocks.StrictMock(); - var eventArgsMock = mocks.StrictMock(""); - mocks.ReplayAll(); + var dataMock = mockRepository.StrictMock(); + var nodeMock = mockRepository.StrictMock(); + var eventArgsMock = mockRepository.StrictMock(""); + mockRepository.ReplayAll(); var nodePresenter = new PipingCalculationInputsNodePresenter(); // Call nodePresenter.OnPropertyChanged(dataMock, nodeMock, eventArgsMock); // Assert - mocks.VerifyAll(); // Expect no calls on arguments + mockRepository.VerifyAll(); // Expect no calls on arguments } [Test] public void OnCollectionChange_Always_DoNothing() { // Setup - var mocks = new MockRepository(); - var dataMock = mocks.StrictMock(); - var eventArgsMock = mocks.StrictMock(); - mocks.ReplayAll(); + var dataMock = mockRepository.StrictMock(); + var eventArgsMock = mockRepository.StrictMock(); + mockRepository.ReplayAll(); var nodePresenter = new PipingCalculationInputsNodePresenter(); // Call nodePresenter.OnCollectionChanged(dataMock, eventArgsMock); // Assert - mocks.VerifyAll(); // Expect no calls on arguments + mockRepository.VerifyAll(); // Expect no calls on arguments } [Test] public void CanRemove_Always_ReturnTrue() { // Setup - var mocks = new MockRepository(); - var dataMock = mocks.StrictMock(); - var nodeMock = mocks.StrictMock(); - mocks.ReplayAll(); + var dataMock = mockRepository.StrictMock(); + var nodeMock = mockRepository.StrictMock(); + mockRepository.ReplayAll(); var nodePresenter = new PipingCalculationInputsNodePresenter(); @@ -373,7 +357,7 @@ // Assert Assert.IsFalse(removalAllowed); - mocks.VerifyAll(); // Expect no calls on arguments + mockRepository.VerifyAll(); // Expect no calls on arguments } [Test] @@ -395,7 +379,7 @@ public void GivenInvalidPipingData_WhenCalculatingFromContextMenu_ThenPipingDataNotifiesObserversAndLogMessageAdded() { // Given - var expectedValidationMessageCount = 6; + var expectedValidationMessageCount = 7; var expectedStatusMessageCount = 2; var expectedLogMessageCount = expectedValidationMessageCount + expectedStatusMessageCount; @@ -423,7 +407,7 @@ public void GivenInvalidPipingData_WhenValidatingFromContextMenu_ThenLogMessageAddedAndNoNotifyObserver() { // Given - var expectedValidationMessageCount = 6; + var expectedValidationMessageCount = 7; var expectedStatusMessageCount = 2; var expectedLogMessageCount = expectedValidationMessageCount + expectedStatusMessageCount; @@ -454,6 +438,8 @@ var expectedValidationStatusMessageCount = 2; var expectedLogMessageCount = expectedCalculationStatusMessageCount + expectedValidationStatusMessageCount; + var random = new Random(22); + var calculateContextMenuItemIndex = 1; var pipingData = new PipingData(); var validPipingInput = new TestPipingInput(); @@ -480,6 +466,10 @@ pipingData.WaterKinematicViscosity = validPipingInput.WaterKinematicViscosity; pipingData.WhitesDragCoefficient = validPipingInput.WhitesDragCoefficient; pipingData.SurfaceLine = new RingtoetsPipingSurfaceLine(); + pipingData.SoilProfile = new PipingSoilProfile(String.Empty,random.NextDouble(), new [] + { + new PipingSoilLayer(1.0) + }); var observer = mockRepository.StrictMock(); var nodePresenter = new PipingCalculationInputsNodePresenter(); Index: src/Plugins/Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingCalculationInputsPropertiesTest.cs =================================================================== diff -u -r308703c02f5602704483e204ad9a475d90eece69 -re5a53456f16d530cb56abb35a256d8cf1f91df3d --- src/Plugins/Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingCalculationInputsPropertiesTest.cs (.../PipingCalculationInputsPropertiesTest.cs) (revision 308703c02f5602704483e204ad9a475d90eece69) +++ src/Plugins/Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingCalculationInputsPropertiesTest.cs (.../PipingCalculationInputsPropertiesTest.cs) (revision e5a53456f16d530cb56abb35a256d8cf1f91df3d) @@ -1,4 +1,5 @@ -using DelftTools.Shell.Core; +using System; +using DelftTools.Shell.Core; using DelftTools.Shell.Gui; using NUnit.Framework; using Rhino.Mocks; @@ -28,12 +29,19 @@ public void GetProperties_WithData_ReturnExpectedValues() { // Setup + var random = new Random(22); + const string name = ""; var surfaceLine = new RingtoetsPipingSurfaceLine(); + var soilProfile = new PipingSoilProfile(String.Empty,random.NextDouble(), new [] + { + new PipingSoilLayer(random.NextDouble()) + }); var pipingData = new PipingData { Name = name, - SurfaceLine = surfaceLine + SurfaceLine = surfaceLine, + SoilProfile = soilProfile }; var properties = new PipingCalculationInputsProperties @@ -69,6 +77,7 @@ Assert.AreEqual(37, properties.BeddingAngle); Assert.AreEqual(2.08e-4, properties.MeanDiameter70); Assert.AreSame(surfaceLine, properties.SurfaceLine); + Assert.AreSame(soilProfile, properties.SoilProfile); } [Test] Index: src/Plugins/Ringtoets/Piping/test/Ringtoets.Piping.Service.Test/TestHelpers/PipingDataFactory.cs =================================================================== diff -u -r7b2fb7be49ba189d624e933485f14a7b94039bbb -re5a53456f16d530cb56abb35a256d8cf1f91df3d --- src/Plugins/Ringtoets/Piping/test/Ringtoets.Piping.Service.Test/TestHelpers/PipingDataFactory.cs (.../PipingDataFactory.cs) (revision 7b2fb7be49ba189d624e933485f14a7b94039bbb) +++ src/Plugins/Ringtoets/Piping/test/Ringtoets.Piping.Service.Test/TestHelpers/PipingDataFactory.cs (.../PipingDataFactory.cs) (revision e5a53456f16d530cb56abb35a256d8cf1f91df3d) @@ -1,4 +1,5 @@ -using Ringtoets.Piping.Data; +using System; +using Ringtoets.Piping.Data; namespace Ringtoets.Piping.Service.Test.TestHelpers { @@ -11,6 +12,11 @@ public static PipingData CreateCalculationWithValidInput() { + var random = new Random(22); + var soilProfile = new PipingSoilProfile(String.Empty, random.NextDouble(), new[] + { + new PipingSoilLayer(random.NextDouble()) + }); return new PipingData { AssessmentLevel = 1.0, @@ -35,7 +41,8 @@ WaterKinematicViscosity = 1.0, WaterVolumetricWeight = 1.0, WhitesDragCoefficient = 1.0, - SurfaceLine = new RingtoetsPipingSurfaceLine() + SurfaceLine = new RingtoetsPipingSurfaceLine(), + SoilProfile = soilProfile }; } }