Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Builders/SoilLayer1DTest.cs =================================================================== diff -u -r223528aec31c0f78f0f8ff67991e43f781075931 -r6e00eba7f45883916d98df04a84f6d0dca2f61fc --- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Builders/SoilLayer1DTest.cs (.../SoilLayer1DTest.cs) (revision 223528aec31c0f78f0f8ff67991e43f781075931) +++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Builders/SoilLayer1DTest.cs (.../SoilLayer1DTest.cs) (revision 6e00eba7f45883916d98df04a84f6d0dca2f61fc) @@ -23,6 +23,7 @@ using System.Drawing; using NUnit.Framework; using Ringtoets.Piping.IO.Builders; +using Ringtoets.Piping.IO.Properties; namespace Ringtoets.Piping.IO.Test.Builders { @@ -65,7 +66,7 @@ [TestCase(1.0)] [TestCase(1.0+1e-12)] [TestCase(2.0)] - public void AsPipingSoilLayer_PropertiesSetWithDifferentLayerParameters_PropertiesAreSetInPipingSoilLayer(double isAquifer) + public void AsPipingSoilLayer_PropertiesSetWithCorrectDistributionsAndDifferentLayerParameters_PropertiesAreSetInPipingSoilLayer(double isAquifer) { // Setup var random = new Random(22); @@ -127,6 +128,66 @@ } [Test] + [TestCase(false, true, true, "Verzadigd gewicht")] + [TestCase(true, false, true, "Korrelgrootte")] + [TestCase(true, true, false, "Doorlatendheid")] + public void AsPipingSoilLayer_IncorrectDistributionType_ThrowsSoilLayerConversionException( + bool isBelowPhreaticLevelDistributionValid, + bool isDiameterD70DistributionValid, + bool isPermeabilityDistributionValid, + string expectedParameter) + { + // Setup + var validShift = 0.0; + var layer = new SoilLayer1D(0.0) + { + BelowPhreaticLevelDistribution = isBelowPhreaticLevelDistributionValid ? SoilLayerConstants.LogNormalDistributionValue : -1, + BelowPhreaticLevelShift = validShift, + DiameterD70Distribution = isDiameterD70DistributionValid ? SoilLayerConstants.LogNormalDistributionValue : -1, + DiameterD70Shift = validShift, + PermeabilityDistribution = isPermeabilityDistributionValid ? SoilLayerConstants.LogNormalDistributionValue : -1, + PermeabilityShift = validShift + }; + + // Call + TestDelegate test = () => layer.AsPipingSoilLayer(); + + // Assert + var message = Assert.Throws(test).Message; + Assert.AreEqual(string.Format("De parameter '{0}' is niet lognormaal verdeeld.", expectedParameter), message); + } + + [Test] + [TestCase(1e-6,0.0,0.0,"Verzadigd gewicht")] + [TestCase(0.0,-1e-6,0.0,"Korrelgrootte")] + [TestCase(0.0,0.0,9,"Doorlatendheid")] + public void AsPipingSoilLayer_ShiftNotZero_ThrowsSoilLayerConversionException( + double belowPhreaticLevelShift, + double diameterD70Shift, + double permeabilityShift, + string expectedParameter) + { + // Setup + var validDistribution = SoilLayerConstants.LogNormalDistributionValue; + var layer = new SoilLayer1D(1.0) + { + BelowPhreaticLevelDistribution = validDistribution, + BelowPhreaticLevelShift = belowPhreaticLevelShift, + DiameterD70Distribution = validDistribution, + DiameterD70Shift = diameterD70Shift, + PermeabilityDistribution = validDistribution, + PermeabilityShift = permeabilityShift + }; + + // Call + TestDelegate test = () => layer.AsPipingSoilLayer(); + + // Assert + var message = Assert.Throws(test).Message; + Assert.AreEqual(string.Format("De parameter '{0}' is niet lognormaal verdeeld.", expectedParameter), message); + } + + [Test] public void AsPipingSoilLayer_PropertiesSetWithNullMaterialName_MaterialNameEmptyInPipingSoilLayer() { // Setup