Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Data/GrassCoverErosionOutwardsWaveConditionsCalculation.cs =================================================================== diff -u -rb4e3629ea2130359117dd403af8db3c8ae0c680b -r038eb94cddc025675fb784caca7acd7f4ec39b89 --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Data/GrassCoverErosionOutwardsWaveConditionsCalculation.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculation.cs) (revision b4e3629ea2130359117dd403af8db3c8ae0c680b) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Data/GrassCoverErosionOutwardsWaveConditionsCalculation.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculation.cs) (revision 038eb94cddc025675fb784caca7acd7f4ec39b89) @@ -21,7 +21,6 @@ using Core.Common.Base; using Ringtoets.Common.Data; -using Ringtoets.Common.Data.Calculation; using Ringtoets.Revetment.Data; using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources; @@ -30,7 +29,7 @@ /// /// Class holding information about a wave conditions calculation for the . /// - public class GrassCoverErosionOutwardsWaveConditionsCalculation : Observable, ICalculation + public class GrassCoverErosionOutwardsWaveConditionsCalculation : Observable, IWaveConditionsCalculation { /// /// Creates a new instance of . @@ -41,13 +40,10 @@ InputParameters = new WaveConditionsInput(); Comments = new Comment(); } + + public WaveConditionsInput InputParameters { get; } /// - /// Gets the input parameters to perform a wave conditions calculation with. - /// - public WaveConditionsInput InputParameters { get; private set; } - - /// /// Gets or sets the output which contains the results of a wave conditions calculation. /// public GrassCoverErosionOutwardsWaveConditionsOutput Output { get; set; } Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Data.Test/GrassCoverErosionOutwardsWaveConditionsCalculationTest.cs =================================================================== diff -u -rb4e3629ea2130359117dd403af8db3c8ae0c680b -r038eb94cddc025675fb784caca7acd7f4ec39b89 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Data.Test/GrassCoverErosionOutwardsWaveConditionsCalculationTest.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculationTest.cs) (revision b4e3629ea2130359117dd403af8db3c8ae0c680b) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Data.Test/GrassCoverErosionOutwardsWaveConditionsCalculationTest.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculationTest.cs) (revision 038eb94cddc025675fb784caca7acd7f4ec39b89) @@ -22,7 +22,6 @@ using System.Linq; using Core.Common.Base; using NUnit.Framework; -using Ringtoets.Common.Data.Calculation; using Ringtoets.Revetment.Data; using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources; @@ -38,7 +37,7 @@ var calculation = new GrassCoverErosionOutwardsWaveConditionsCalculation(); // Assert - Assert.IsInstanceOf(calculation); + Assert.IsInstanceOf(calculation); Assert.IsInstanceOf(calculation); Assert.AreEqual(RingtoetsCommonDataResources.Calculation_DefaultName, calculation.Name); Index: Ringtoets/Revetment/src/Ringtoets.Revetment.Data/IWaveConditionsCalculation.cs =================================================================== diff -u --- Ringtoets/Revetment/src/Ringtoets.Revetment.Data/IWaveConditionsCalculation.cs (revision 0) +++ Ringtoets/Revetment/src/Ringtoets.Revetment.Data/IWaveConditionsCalculation.cs (revision 038eb94cddc025675fb784caca7acd7f4ec39b89) @@ -0,0 +1,36 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets 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 Ringtoets.Common.Data.Calculation; + +namespace Ringtoets.Revetment.Data +{ + /// + /// Interface for wave conditions related calculation. + /// + public interface IWaveConditionsCalculation : ICalculation + { + /// + /// Gets the input parameters to perform a wave conditions calculation with. + /// + WaveConditionsInput InputParameters { get; } + } +} \ No newline at end of file Index: Ringtoets/Revetment/src/Ringtoets.Revetment.Data/Ringtoets.Revetment.Data.csproj =================================================================== diff -u -r23d1e296e2da4364fbfe346e68d582dfcf966bb0 -r038eb94cddc025675fb784caca7acd7f4ec39b89 --- Ringtoets/Revetment/src/Ringtoets.Revetment.Data/Ringtoets.Revetment.Data.csproj (.../Ringtoets.Revetment.Data.csproj) (revision 23d1e296e2da4364fbfe346e68d582dfcf966bb0) +++ Ringtoets/Revetment/src/Ringtoets.Revetment.Data/Ringtoets.Revetment.Data.csproj (.../Ringtoets.Revetment.Data.csproj) (revision 038eb94cddc025675fb784caca7acd7f4ec39b89) @@ -40,6 +40,7 @@ Properties\GlobalAssembly.cs + True Index: Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Importers/WaveConditionsCalculationConfigurationImporter.cs =================================================================== diff -u --- Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Importers/WaveConditionsCalculationConfigurationImporter.cs (revision 0) +++ Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Importers/WaveConditionsCalculationConfigurationImporter.cs (revision 038eb94cddc025675fb784caca7acd7f4ec39b89) @@ -0,0 +1,66 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets 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 Ringtoets.Common.Data.Calculation; +using Ringtoets.Common.IO.FileImporters; +using Ringtoets.Revetment.Data; +using Ringtoets.Revetment.IO.Readers; +using RingtoetsCommonIOResources = Ringtoets.Common.IO.Properties.Resources; + +namespace Ringtoets.Revetment.IO.Importers +{ + /// + /// Imports a wave conditions calculation configuration from an XML file and stores it on a + /// . + /// + /// The type of the calculation to import. + public class WaveConditionsCalculationConfigurationImporter + : CalculationConfigurationImporter + where T : IWaveConditionsCalculation, new() + { + /// + /// Creates a new instance of . + /// + /// The path to the XML file to import from. + /// The calculation group to update. + /// Thrown when any parameter is + /// null. + public WaveConditionsCalculationConfigurationImporter(string xmlFilePath, + CalculationGroup importTarget) + : base(xmlFilePath, importTarget) {} + + protected override WaveConditionsCalculationConfigurationReader CreateCalculationConfigurationReader(string xmlFilePath) + { + return new WaveConditionsCalculationConfigurationReader(xmlFilePath); + } + + protected override ICalculation ParseReadCalculation(ReadWaveConditionsCalculation readCalculation) + { + var calculation = new T + { + Name = readCalculation.Name + }; + + return calculation; + } + } +} \ No newline at end of file Index: Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Readers/ReadWaveConditionsCalculation.cs =================================================================== diff -u -r3f40ee696a93367a869de85b3ed0fad2c54a23f2 -r038eb94cddc025675fb784caca7acd7f4ec39b89 --- Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Readers/ReadWaveConditionsCalculation.cs (.../ReadWaveConditionsCalculation.cs) (revision 3f40ee696a93367a869de85b3ed0fad2c54a23f2) +++ Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Readers/ReadWaveConditionsCalculation.cs (.../ReadWaveConditionsCalculation.cs) (revision 038eb94cddc025675fb784caca7acd7f4ec39b89) @@ -27,7 +27,7 @@ /// /// Class that represents a wave conditions calculation that is read via . /// - internal class ReadWaveConditionsCalculation : IReadConfigurationItem + public class ReadWaveConditionsCalculation : IReadConfigurationItem { /// /// Creates a new instance of . @@ -121,7 +121,7 @@ /// /// Class holding the various construction parameters for . /// - internal class ConstructionProperties + public class ConstructionProperties { /// /// Gets or sets the value for . Index: Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Readers/WaveConditionsCalculationConfigurationReader.cs =================================================================== diff -u -r3f40ee696a93367a869de85b3ed0fad2c54a23f2 -r038eb94cddc025675fb784caca7acd7f4ec39b89 --- Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Readers/WaveConditionsCalculationConfigurationReader.cs (.../WaveConditionsCalculationConfigurationReader.cs) (revision 3f40ee696a93367a869de85b3ed0fad2c54a23f2) +++ Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Readers/WaveConditionsCalculationConfigurationReader.cs (.../WaveConditionsCalculationConfigurationReader.cs) (revision 038eb94cddc025675fb784caca7acd7f4ec39b89) @@ -35,7 +35,7 @@ /// This class reads a wave conditions calculation configuration from XML and creates a collection of corresponding /// , typically containing one or more . /// - internal class WaveConditionsCalculationConfigurationReader : CalculationConfigurationReader + public class WaveConditionsCalculationConfigurationReader : CalculationConfigurationReader { private const string hydraulicBoundaryLocationSchemaName = "HrLocatieSchema.xsd"; private const string orientationSchemaName = "OrientatieSchema.xsd"; Index: Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Ringtoets.Revetment.IO.csproj =================================================================== diff -u -r3f40ee696a93367a869de85b3ed0fad2c54a23f2 -r038eb94cddc025675fb784caca7acd7f4ec39b89 --- Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Ringtoets.Revetment.IO.csproj (.../Ringtoets.Revetment.IO.csproj) (revision 3f40ee696a93367a869de85b3ed0fad2c54a23f2) +++ Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Ringtoets.Revetment.IO.csproj (.../Ringtoets.Revetment.IO.csproj) (revision 038eb94cddc025675fb784caca7acd7f4ec39b89) @@ -48,6 +48,7 @@ + True Index: Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Importers/WaveConditionsCalculationConfigurationImporterTest.cs =================================================================== diff -u --- Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Importers/WaveConditionsCalculationConfigurationImporterTest.cs (revision 0) +++ Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Importers/WaveConditionsCalculationConfigurationImporterTest.cs (revision 038eb94cddc025675fb784caca7acd7f4ec39b89) @@ -0,0 +1,87 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets 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.IO; +using Core.Common.Base; +using Core.Common.TestUtil; +using NUnit.Framework; +using Ringtoets.Common.Data; +using Ringtoets.Common.Data.Calculation; +using Ringtoets.Common.IO.FileImporters; +using Ringtoets.Revetment.Data; +using Ringtoets.Revetment.IO.Importers; +using Ringtoets.Revetment.IO.Readers; + +namespace Ringtoets.Revetment.IO.Test.Importers +{ + [TestFixture] + public class WaveConditionsCalculationConfigurationImporterTest + { + private readonly string path = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Revetment.IO, "WaveConditionsCalculationConfigurationImporter"); + + [Test] + public void Constructor_ExpectedValues() + { + // Call + var importer = new WaveConditionsCalculationConfigurationImporter( + "", + new CalculationGroup()); + + // Assert + Assert.IsInstanceOf>(importer); + } + + [Test] + public void Import_ValidConfigurationWithValidData_DataAddedToModel() + { + // Setup + string filePath = Path.Combine(path, "validConfigurationFullCalculation.xml"); + + var calculationGroup = new CalculationGroup(); + var importer = new WaveConditionsCalculationConfigurationImporter( + filePath, + calculationGroup); + + // Call + bool successful = importer.Import(); + + // Assert + Assert.IsTrue(successful); + + Assert.AreEqual(1, calculationGroup.Children.Count); + var calculation = (IWaveConditionsCalculation) calculationGroup.Children[0]; + Assert.AreEqual("Berekening 1", calculation.Name); + } + + private class SimpleWaveConditionsCalculation : Observable, IWaveConditionsCalculation + { + public string Name { get; set; } + public bool HasOutput { get; } + public Comment Comments { get; } + public void ClearOutput() + { + throw new System.NotImplementedException(); + } + + public WaveConditionsInput InputParameters { get; } + } + } +} \ No newline at end of file Index: Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Ringtoets.Revetment.IO.Test.csproj =================================================================== diff -u -r96cd93f1a08294e5af3fec5f5ae0b59cbe914c4b -r038eb94cddc025675fb784caca7acd7f4ec39b89 --- Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Ringtoets.Revetment.IO.Test.csproj (.../Ringtoets.Revetment.IO.Test.csproj) (revision 96cd93f1a08294e5af3fec5f5ae0b59cbe914c4b) +++ Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/Ringtoets.Revetment.IO.Test.csproj (.../Ringtoets.Revetment.IO.Test.csproj) (revision 038eb94cddc025675fb784caca7acd7f4ec39b89) @@ -53,6 +53,7 @@ + Index: Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/test-data/WaveConditionsCalculationConfigurationImporter/validConfigurationFullCalculation.xml =================================================================== diff -u --- Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/test-data/WaveConditionsCalculationConfigurationImporter/validConfigurationFullCalculation.xml (revision 0) +++ Ringtoets/Revetment/test/Ringtoets.Revetment.IO.Test/test-data/WaveConditionsCalculationConfigurationImporter/validConfigurationFullCalculation.xml (revision 038eb94cddc025675fb784caca7acd7f4ec39b89) @@ -0,0 +1,19 @@ + + + + HRlocatie + 1.1 + 2.2 + 3.3 + 4.4 + 0.5 + Voorlandprofiel + 5.5 + + true + caisson + 6.6 + false + + + Index: Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Data/StabilityStoneCoverWaveConditionsCalculation.cs =================================================================== diff -u -rb4e3629ea2130359117dd403af8db3c8ae0c680b -r038eb94cddc025675fb784caca7acd7f4ec39b89 --- Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Data/StabilityStoneCoverWaveConditionsCalculation.cs (.../StabilityStoneCoverWaveConditionsCalculation.cs) (revision b4e3629ea2130359117dd403af8db3c8ae0c680b) +++ Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Data/StabilityStoneCoverWaveConditionsCalculation.cs (.../StabilityStoneCoverWaveConditionsCalculation.cs) (revision 038eb94cddc025675fb784caca7acd7f4ec39b89) @@ -21,7 +21,6 @@ using Core.Common.Base; using Ringtoets.Common.Data; -using Ringtoets.Common.Data.Calculation; using Ringtoets.Revetment.Data; using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources; @@ -30,7 +29,7 @@ /// /// Class holding information about a wave conditions calculation for the . /// - public class StabilityStoneCoverWaveConditionsCalculation : Observable, ICalculation + public class StabilityStoneCoverWaveConditionsCalculation : Observable, IWaveConditionsCalculation { /// /// Creates a new instance of . @@ -41,13 +40,10 @@ InputParameters = new WaveConditionsInput(); Comments = new Comment(); } + + public WaveConditionsInput InputParameters { get; } /// - /// Gets the input parameters to perform a wave conditions calculation with. - /// - public WaveConditionsInput InputParameters { get; private set; } - - /// /// Gets or sets the output which contains the results of a wave conditions calculation. /// public StabilityStoneCoverWaveConditionsOutput Output { get; set; } Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Data.Test/StabilityStoneCoverWaveConditionsCalculationTest.cs =================================================================== diff -u -rb4e3629ea2130359117dd403af8db3c8ae0c680b -r038eb94cddc025675fb784caca7acd7f4ec39b89 --- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Data.Test/StabilityStoneCoverWaveConditionsCalculationTest.cs (.../StabilityStoneCoverWaveConditionsCalculationTest.cs) (revision b4e3629ea2130359117dd403af8db3c8ae0c680b) +++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Data.Test/StabilityStoneCoverWaveConditionsCalculationTest.cs (.../StabilityStoneCoverWaveConditionsCalculationTest.cs) (revision 038eb94cddc025675fb784caca7acd7f4ec39b89) @@ -22,7 +22,6 @@ using System.Linq; using Core.Common.Base; using NUnit.Framework; -using Ringtoets.Common.Data.Calculation; using Ringtoets.Revetment.Data; namespace Ringtoets.StabilityStoneCover.Data.Test @@ -37,7 +36,7 @@ var calculation = new StabilityStoneCoverWaveConditionsCalculation(); // Assert - Assert.IsInstanceOf(calculation); + Assert.IsInstanceOf(calculation); Assert.IsInstanceOf(calculation); Assert.AreEqual("Nieuwe berekening", calculation.Name); Index: Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Data/WaveImpactAsphaltCoverWaveConditionsCalculation.cs =================================================================== diff -u -rb4e3629ea2130359117dd403af8db3c8ae0c680b -r038eb94cddc025675fb784caca7acd7f4ec39b89 --- Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Data/WaveImpactAsphaltCoverWaveConditionsCalculation.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculation.cs) (revision b4e3629ea2130359117dd403af8db3c8ae0c680b) +++ Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Data/WaveImpactAsphaltCoverWaveConditionsCalculation.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculation.cs) (revision 038eb94cddc025675fb784caca7acd7f4ec39b89) @@ -21,7 +21,6 @@ using Core.Common.Base; using Ringtoets.Common.Data; -using Ringtoets.Common.Data.Calculation; using Ringtoets.Revetment.Data; using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources; @@ -30,7 +29,7 @@ /// /// Class holding information about a wave conditions calculation for the . /// - public class WaveImpactAsphaltCoverWaveConditionsCalculation : Observable, ICalculation + public class WaveImpactAsphaltCoverWaveConditionsCalculation : Observable, IWaveConditionsCalculation { /// /// Creates a new instance of . @@ -42,10 +41,7 @@ Comments = new Comment(); } - /// - /// Gets the input parameters to perform a wave conditions calculation with. - /// - public WaveConditionsInput InputParameters { get; private set; } + public WaveConditionsInput InputParameters { get; } /// /// Gets or sets the output which contains the results of a wave conditions calculation. Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Data.Test/WaveImpactAsphaltCoverWaveConditionsCalculationTest.cs =================================================================== diff -u -rb4e3629ea2130359117dd403af8db3c8ae0c680b -r038eb94cddc025675fb784caca7acd7f4ec39b89 --- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Data.Test/WaveImpactAsphaltCoverWaveConditionsCalculationTest.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationTest.cs) (revision b4e3629ea2130359117dd403af8db3c8ae0c680b) +++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Data.Test/WaveImpactAsphaltCoverWaveConditionsCalculationTest.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationTest.cs) (revision 038eb94cddc025675fb784caca7acd7f4ec39b89) @@ -22,7 +22,6 @@ using System.Linq; using Core.Common.Base; using NUnit.Framework; -using Ringtoets.Common.Data.Calculation; using Ringtoets.Revetment.Data; namespace Ringtoets.WaveImpactAsphaltCover.Data.Test @@ -37,7 +36,7 @@ var calculation = new WaveImpactAsphaltCoverWaveConditionsCalculation(); // Assert - Assert.IsInstanceOf(calculation); + Assert.IsInstanceOf(calculation); Assert.IsInstanceOf(calculation); Assert.AreEqual("Nieuwe berekening", calculation.Name);