Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityInwards/MacroStabilityInwardsCalculationOutputEntityReadExtensionsTest.cs =================================================================== diff -u -rf6980957baa71e954fa585029b44c365c7dbf993 -r11f07beedffdae5eee71141830eb73827dd3ae94 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityInwards/MacroStabilityInwardsCalculationOutputEntityReadExtensionsTest.cs (.../MacroStabilityInwardsCalculationOutputEntityReadExtensionsTest.cs) (revision f6980957baa71e954fa585029b44c365c7dbf993) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityInwards/MacroStabilityInwardsCalculationOutputEntityReadExtensionsTest.cs (.../MacroStabilityInwardsCalculationOutputEntityReadExtensionsTest.cs) (revision 11f07beedffdae5eee71141830eb73827dd3ae94) @@ -88,16 +88,16 @@ SlipPlaneTangentLinesXml = new TangentLinesXmlSerializer().ToXml(tangentLines), SlipPlaneLeftGridXLeft = random.NextDouble(), SlipPlaneLeftGridXRight = random.NextDouble(), - SlipPlaneLeftGridNrOfHorizontalPoints = random.Next(), + SlipPlaneLeftGridNrOfHorizontalPoints = random.Next(1, 100), SlipPlaneLeftGridZTop = random.NextDouble(), SlipPlaneLeftGridZBottom = random.NextDouble(), - SlipPlaneLeftGridNrOfVerticalPoints = random.Next(), + SlipPlaneLeftGridNrOfVerticalPoints = random.Next(1, 100), SlipPlaneRightGridXLeft = random.NextDouble(), SlipPlaneRightGridXRight = random.NextDouble(), - SlipPlaneRightGridNrOfHorizontalPoints = random.Next(), + SlipPlaneRightGridNrOfHorizontalPoints = random.Next(1, 100), SlipPlaneRightGridZTop = random.NextDouble(), SlipPlaneRightGridZBottom = random.NextDouble(), - SlipPlaneRightGridNrOfVerticalPoints = random.Next() + SlipPlaneRightGridNrOfVerticalPoints = random.Next(1, 100) }; // Call @@ -111,11 +111,7 @@ public void Read_EntityWithNullValues_ReturnExpectedOutputWithNaNValues() { // Setup - var entity = new MacroStabilityInwardsCalculationOutputEntity - { - SlidingCurveSliceXML = new MacroStabilityInwardsSliceXmlSerializer().ToXml(new MacroStabilityInwardsSlice[0]), - SlipPlaneTangentLinesXml = new TangentLinesXmlSerializer().ToXml(new double[0]) - }; + MacroStabilityInwardsCalculationOutputEntity entity = CreateValidCalculationOutputEntity(); // Call MacroStabilityInwardsOutput output = entity.Read(); @@ -128,11 +124,8 @@ public void Read_SlipPlaneTangentLineXMLEmpty_ThrowsArgumentException() { // Setup - var entity = new MacroStabilityInwardsCalculationOutputEntity - { - SlidingCurveSliceXML = new MacroStabilityInwardsSliceXmlSerializer().ToXml(new MacroStabilityInwardsSlice[0]), - SlipPlaneTangentLinesXml = string.Empty - }; + MacroStabilityInwardsCalculationOutputEntity entity = CreateValidCalculationOutputEntity(); + entity.SlipPlaneTangentLinesXml = string.Empty; // Call TestDelegate call = () => entity.Read(); @@ -146,11 +139,8 @@ public void Read_SlidingCurveSliceXMLEmpty_ThrowsArgumentException() { // Setup - var entity = new MacroStabilityInwardsCalculationOutputEntity - { - SlidingCurveSliceXML = string.Empty, - SlipPlaneTangentLinesXml = new TangentLinesXmlSerializer().ToXml(new double[0]) - }; + MacroStabilityInwardsCalculationOutputEntity entity = CreateValidCalculationOutputEntity(); + entity.SlidingCurveSliceXML = string.Empty; // Call TestDelegate call = () => entity.Read(); @@ -159,5 +149,19 @@ var exception = Assert.Throws(call); Assert.AreEqual("xml", exception.ParamName); } + + private static MacroStabilityInwardsCalculationOutputEntity CreateValidCalculationOutputEntity() + { + var random = new Random(31); + return new MacroStabilityInwardsCalculationOutputEntity + { + SlidingCurveSliceXML = new MacroStabilityInwardsSliceXmlSerializer().ToXml(new MacroStabilityInwardsSlice[0]), + SlipPlaneTangentLinesXml = new TangentLinesXmlSerializer().ToXml(new double[0]), + SlipPlaneLeftGridNrOfHorizontalPoints = random.Next(1, 100), + SlipPlaneLeftGridNrOfVerticalPoints = random.Next(1, 100), + SlipPlaneRightGridNrOfHorizontalPoints = random.Next(1, 100), + SlipPlaneRightGridNrOfVerticalPoints = random.Next(1, 100) + }; + } } } \ No newline at end of file