// Copyright (C) Stichting Deltares 2017. 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.Xml.Linq; using Deltares.DamEngine.Calculators.General; using Deltares.DamEngine.Calculators.KernelWrappers.DamMacroStabilityCommon.Assemblers; using NUnit.Framework; namespace Deltares.DamEngine.Calculators.Tests.KernelWrappers.DamMacroStability { [TestFixture] public class DamMStabGeometry2DDataAssemblerTest { private DAMMStabGeometry2DDataAssembler assembler; private const double cTolerance = 0.001; [SetUp] public void TestSetup() { this.assembler = new DAMMStabGeometry2DDataAssembler(); } [Test] public void CanReadDAMMStabGeometry2DDataXML() { const string testFileName = @"KernelWrappers\DamMacroStability\TestData\Geometry2DDataOutput.xml"; XDocument doc = XDocument.Load(testFileName); Geometry2DData geometry2DData = assembler.CreateOutputObject(doc); Assert.AreEqual(11, geometry2DData.LayerCount); var layer = geometry2DData.GetLayer(1); Assert.AreEqual("Sand", layer.soilName); Assert.IsNotNull(layer.boundaryLine); Assert.AreEqual(3, layer.boundaryLine.Points.Count); Assert.AreEqual(-50.0, layer.boundaryLine.Points[0].X, cTolerance); Assert.AreEqual(-10.2, layer.boundaryLine.Points[0].Z, cTolerance); Assert.AreEqual(13.17, layer.boundaryLine.Points[1].X, cTolerance); Assert.AreEqual(-10.2, layer.boundaryLine.Points[1].Z, cTolerance); Assert.AreEqual(100.0, layer.boundaryLine.Points[2].X, cTolerance); Assert.AreEqual(-10.2, layer.boundaryLine.Points[2].Z, cTolerance); layer = geometry2DData.GetLayer(10); Assert.AreEqual("Surchage", layer.soilName); Assert.IsNotNull(layer.boundaryLine); Assert.AreEqual(19, layer.boundaryLine.Points.Count); Assert.AreEqual(-50.0, layer.boundaryLine.Points[0].X, cTolerance); Assert.AreEqual(-5.97, layer.boundaryLine.Points[0].Z, cTolerance); Assert.AreEqual(100.0, layer.boundaryLine.Points[18].X, cTolerance); Assert.AreEqual(-0.86, layer.boundaryLine.Points[18].Z, cTolerance); } } }