// Copyright (C) Stichting Deltares 2018. All rights reserved. // // This file is part of the Dam Engine. // // The Dam Engine is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero 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 Affero General Public License for more details. // // You should have received a copy of the GNU Affero 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 System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Deltares.DamEngine.Calculators.KernelWrappers.Common; using Deltares.DamEngine.Data.General; using Deltares.DamEngine.Data.General.PlLines; using Deltares.DamEngine.Data.Geometry; using Deltares.DamEngine.Data.Geotechnics; using Deltares.DamEngine.TestHelpers; using NUnit.Framework; namespace Deltares.DamEngine.Calculators.Tests.KernelWrappers.Common { [TestFixture] public class PlLinesHelperTests { [Test] public void TestCreatePlLines() { // expected values retrieved from debugging Dam Classic (rev.663) // test CanCalculateThePipingFactorUsingSellmeijer4Forces var location = new Location(); location.SurfaceLine = FactoryForSurfaceLines.CreateSurfaceLineTutorial1(); var soilProfile1D = FactoryForSoilProfiles.CreatePipingSellmeijerProfileWithOneSandlayer(); var riverLevel = 1.0; UpliftSituation upliftSituation; var plLines = PlLinesHelper.CreatePlLines(location, soilProfile1D, riverLevel, out upliftSituation); Assert.AreEqual(4, plLines.PLLineCount); Assert.AreEqual(8, plLines.Lines[PLLineType.PL1].Points.Count); Assert.IsTrue(new PLLinePoint(0.000, 1.000).LocationEquals(plLines.Lines[PLLineType.PL1].Points[0])); Assert.IsTrue(new PLLinePoint(14.900, 1.000).LocationEquals(plLines.Lines[PLLineType.PL1].Points[1])); Assert.IsTrue(new PLLinePoint(34.500, 0.500).LocationEquals(plLines.Lines[PLLineType.PL1].Points[2])); Assert.IsTrue(new PLLinePoint(40.500, 0.000).LocationEquals(plLines.Lines[PLLineType.PL1].Points[3])); Assert.IsTrue(new PLLinePoint(50.500, 0.000).LocationEquals(plLines.Lines[PLLineType.PL1].Points[4])); Assert.IsTrue(new PLLinePoint(58.500, 0.000).LocationEquals(plLines.Lines[PLLineType.PL1].Points[5])); Assert.IsTrue(new PLLinePoint(61.500, 0.000).LocationEquals(plLines.Lines[PLLineType.PL1].Points[6])); Assert.IsTrue(new PLLinePoint(75.000, 0.000).LocationEquals(plLines.Lines[PLLineType.PL1].Points[7])); Assert.AreEqual(0, plLines.Lines[PLLineType.PL2].Points.Count); Assert.AreEqual(2, plLines.Lines[PLLineType.PL3].Points.Count); Assert.IsTrue(new PLLinePoint(0.000, 1.000).LocationEquals(plLines.Lines[PLLineType.PL3].Points[0])); Assert.IsTrue(new PLLinePoint(75.000, 1.000).LocationEquals(plLines.Lines[PLLineType.PL3].Points[1])); Assert.AreEqual(0, plLines.Lines[PLLineType.PL4].Points.Count); } } }