Index: DamClients/DamUI/trunk/src/Dam/Tests/Deltares.Dam.Tests.csproj =================================================================== diff -u -r2538 -r2632 --- DamClients/DamUI/trunk/src/Dam/Tests/Deltares.Dam.Tests.csproj (.../Deltares.Dam.Tests.csproj) (revision 2538) +++ DamClients/DamUI/trunk/src/Dam/Tests/Deltares.Dam.Tests.csproj (.../Deltares.Dam.Tests.csproj) (revision 2632) @@ -126,6 +126,7 @@ + @@ -498,6 +499,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest Fisheye: Tag 2466 refers to a dead (removed) revision in file `DamClients/DamUI/trunk/src/Dam/Tests/TestData/SampleCalculationParameters.xml'. Fisheye: No comparison available. Pass `N' to diff? Index: DamClients/DamUI/trunk/src/Dam/Tests/CalculationParametersAssemblerTest.cs =================================================================== diff -u --- DamClients/DamUI/trunk/src/Dam/Tests/CalculationParametersAssemblerTest.cs (revision 0) +++ DamClients/DamUI/trunk/src/Dam/Tests/CalculationParametersAssemblerTest.cs (revision 2632) @@ -0,0 +1,94 @@ +// Copyright (C) Stichting Deltares 2019. All rights reserved. +// +// This file is part of the application DAM - UI. +// +// DAM - UI 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.Xml.Linq; +using Deltares.Dam.Data; +using Deltares.Dam.Data.Assemblers; +using NUnit.Framework; + +namespace Deltares.Dam.Tests +{ + + [TestFixture] + public class CalculationParametersAssemblerTest + { + private const string testFileName = @"TestData\SampleCalculationParameters.xml"; + private const double Precision = 1e-8; + private XDocument testDoc; + private CalculationParametersAssembler assembler; + + + #region Setup/Teardown + + [SetUp] + public void TestSetup() + { + this.assembler = new CalculationParametersAssembler(); + } + + #endregion + + [TestFixtureSetUp] + public void TestFixtureSetup() + { + this.testDoc = XDocument.Load(testFileName); + } + + [Test] + public void CreateEntityFromDto() + { + // First validate test XML against schema + string message; + if (!this.assembler.ValidateSchema(this.testDoc, out message)) + { + Assert.Fail("SCHEMA VALIDATION: " + message); + } + + // Do the thing: create MStabParameters from XML element + CalculationParameters calculationParameters = this.assembler.CreateDomainObject(this.testDoc); + + Assert.IsNotNull(calculationParameters); + + // Calculation modules + Assert.IsNotNull(calculationParameters.CalculationModules); + + Assert.IsTrue(calculationParameters.CalculationModules.StabilityOutside, "CalculationModules.StabilityOutside"); + Assert.IsTrue(calculationParameters.CalculationModules.StabilityInside, "CalculationModules.Stability"); + Assert.IsTrue(calculationParameters.CalculationModules.PipingWti, "CalculationModules.PipingWti"); + Assert.IsTrue(calculationParameters.CalculationModules.PipingBligh, "CalculationModules.PipingBligh"); + Assert.IsTrue(calculationParameters.CalculationModules.PipingSellmeijer, "CalculationModules.PipingSellmeijer"); + Assert.IsTrue(calculationParameters.CalculationModules.PipingSellmeijerProbabilistic, "CalculationModules.PipingSellmeijerProbabilistic"); + Assert.IsTrue(calculationParameters.CalculationModules.PipingIJkdijk, "CalculationModules.PipingIJkdijk"); + Assert.IsTrue(calculationParameters.CalculationModules.Overtopping, "CalculationModules.Overtopping"); + + // MStab parameters + Assert.IsNotNull(calculationParameters.MStabParameters); + + Assert.AreEqual(false, calculationParameters.MStabParameters.IsCalculateAllStabilityProjectsAtOnce, "MStabParameters.IsCalculateAllStabilityProjectsAtOnce"); + Assert.AreEqual(MStabModelType.UpliftVan, calculationParameters.MStabParameters.Model, "MStabParameters.Model"); + Assert.AreEqual(MStabShearStrength.StressTables, calculationParameters.MStabParameters.ShearStrength, "MStabParameters.ShearStrength"); + Assert.AreEqual(MStabSearchMethod.Grid, calculationParameters.MStabParameters.SearchMethod, "MStabParameters.SearchMethod"); + Assert.AreEqual(false, calculationParameters.MStabParameters.IsProbabilistic, "MStabParameters.IsProbabilistic"); + Assert.IsTrue(calculationParameters.MStabParameters.CalculationOptions.ZonesType.Equals(MStabZonesType.ForbiddenZone), "MStabParameters.CalculationOptions.ZonesType"); + Assert.AreEqual(true, calculationParameters.MStabParameters.IsOverrulePLLineCreationMethod, "MStabParameters.IsOverrulePLLineCreationMethod"); + } + } +} \ No newline at end of file