Index: Riskeer/Piping/test/Riskeer.Piping.Data.TestUtil/PipingCalculationScenarioTestFactorycs.cs =================================================================== diff -u --- Riskeer/Piping/test/Riskeer.Piping.Data.TestUtil/PipingCalculationScenarioTestFactorycs.cs (revision 0) +++ Riskeer/Piping/test/Riskeer.Piping.Data.TestUtil/PipingCalculationScenarioTestFactorycs.cs (revision 24ba1cb10f3b58b12d6a46d132186f210d614773) @@ -0,0 +1,132 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of Riskeer. +// +// Riskeer is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Core.Common.Base.Data; +using Core.Common.Base.Geometry; +using Riskeer.Common.Data.Hydraulics; +using Riskeer.Common.Data.Probabilistics; +using Riskeer.Piping.Data.SoilProfile; +using Riskeer.Piping.Primitives; + +namespace Riskeer.Piping.Data.TestUtil +{ + /// + /// Helper class for creating instances of . + /// + public static class PipingCalculationScenarioTestFactory + { + private const double bottom = 1.12; + private const double top = 10.56; + + /// + /// Creates a calculation with valid input. + /// + /// The hydraulic boundary location to set to the input. + /// Indicator whether the calculation has output. + /// A new . + /// The caller is responsible for actually providing a valid hydraulic boundary location + /// (for instance when it comes to the presence of a normative assessment level). + /// Throw when is null. + public static PipingCalculation CreatePipingCalculationScenarioWithValidInput(HydraulicBoundaryLocation hydraulicBoundaryLocation, bool hasOutput = false) + { + if (hydraulicBoundaryLocation == null) + { + throw new ArgumentNullException(nameof(hydraulicBoundaryLocation)); + } + + return new TestPipingCalculation(new TestPipingInput + { + DampingFactorExit = + { + Mean = (RoundedDouble) 1.0 + }, + PhreaticLevelExit = + { + Mean = (RoundedDouble) 2.0 + }, + SurfaceLine = GetSurfaceLine(), + StochasticSoilProfile = GetStochasticSoilProfile(), + HydraulicBoundaryLocation = hydraulicBoundaryLocation + }, hasOutput); + } + + internal static PipingSurfaceLine GetSurfaceLine() + { + var surfaceLine = new PipingSurfaceLine(string.Empty); + var firstCharacteristicPointLocation = new Point3D(0.2, 0.0, bottom + 3 * top / 4); + var secondCharacteristicPointLocation = new Point3D(0.3, 0.0, bottom + 2 * top / 4); + var thirdCharacteristicPointLocation = new Point3D(0.4, 0.0, bottom + top / 4); + var fourthCharacteristicPointLocation = new Point3D(0.5, 0.0, bottom + 2 * top / 4); + var fifthCharacteristicPointLocation = new Point3D(0.6, 0.0, bottom + 3 * top / 4); + surfaceLine.SetGeometry(new[] + { + new Point3D(0.0, 0.0, 0.0), + firstCharacteristicPointLocation, + secondCharacteristicPointLocation, + thirdCharacteristicPointLocation, + fourthCharacteristicPointLocation, + fifthCharacteristicPointLocation, + new Point3D(1.0, 0.0, top) + }); + surfaceLine.SetDikeToeAtPolderAt(firstCharacteristicPointLocation); + surfaceLine.SetDitchDikeSideAt(secondCharacteristicPointLocation); + surfaceLine.SetBottomDitchDikeSideAt(thirdCharacteristicPointLocation); + surfaceLine.SetBottomDitchPolderSideAt(fourthCharacteristicPointLocation); + surfaceLine.SetDitchPolderSideAt(fifthCharacteristicPointLocation); + surfaceLine.ReferenceLineIntersectionWorldPoint = new Point2D(0.0, 0.0); + + return surfaceLine; + } + + internal static PipingStochasticSoilProfile GetStochasticSoilProfile() + { + return new PipingStochasticSoilProfile( + 0.0, new PipingSoilProfile(string.Empty, 0.0, new[] + { + new PipingSoilLayer(top) + { + IsAquifer = false, + BelowPhreaticLevel = new LogNormalDistribution + { + Mean = (RoundedDouble) 17.5, + StandardDeviation = (RoundedDouble) 0, + Shift = (RoundedDouble) 10 + } + }, + new PipingSoilLayer(top / 2) + { + IsAquifer = true, + DiameterD70 = new VariationCoefficientLogNormalDistribution + { + Mean = (RoundedDouble) 4.0e-4, + CoefficientOfVariation = (RoundedDouble) 0 + }, + Permeability = new VariationCoefficientLogNormalDistribution + { + Mean = (RoundedDouble) 1.0, + CoefficientOfVariation = (RoundedDouble) 0.5 + } + } + }, SoilProfileType.SoilProfile1D)); + } + } +} \ No newline at end of file