Index: Ringtoets/Common/src/Ringtoets.Common.IO/Exporters/CalculationConfigurationExporter.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.IO/Exporters/CalculationConfigurationExporter.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/Exporters/CalculationConfigurationExporter.cs (revision f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04)
@@ -0,0 +1,80 @@
+// 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 System.Collections.Generic;
+using Core.Common.Base.IO;
+using Core.Common.IO.Exceptions;
+using Core.Common.Utils;
+using log4net;
+using Ringtoets.Common.Data.Calculation;
+using Ringtoets.Common.IO.Properties;
+using Ringtoets.Common.IO.Writers;
+
+namespace Ringtoets.Common.IO.Exporters
+{
+ ///
+ /// Base class for exporting a configuration and storing it as an XML file.
+ ///
+ public abstract class CalculationConfigurationExporter : IFileExporter
+ where TCalculation : class, ICalculation
+ where TWriter : CalculationConfigurationWriter, new()
+ {
+ private static readonly ILog log = LogManager.GetLogger(typeof(CalculationConfigurationExporter));
+ private readonly IEnumerable configuration;
+ private readonly string filePath;
+
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The configuration to export.
+ /// The path of the XML file to export to.
+ /// Thrown when is null.
+ /// Thrown when is invalid.
+ protected CalculationConfigurationExporter(IEnumerable configuration, string filePath)
+ {
+ if (configuration == null)
+ {
+ throw new ArgumentNullException(nameof(configuration));
+ }
+
+ IOUtils.ValidateFilePath(filePath);
+
+ this.configuration = configuration;
+ this.filePath = filePath;
+ }
+
+ public bool Export()
+ {
+ try
+ {
+ new TWriter().Write(configuration, filePath);
+ }
+ catch (CriticalFileWriteException e)
+ {
+ log.ErrorFormat(Resources.ConfigurationExporter_Export_Exception_0_no_configuration_exported, e.Message);
+ return false;
+ }
+
+ return true;
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04 refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.IO/Exporters/ConfigurationExporter.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Common/src/Ringtoets.Common.IO/Ringtoets.Common.IO.csproj
===================================================================
diff -u -r7594d7f46113b5c5f4f41bfbd0183a3789f648b9 -rf9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04
--- Ringtoets/Common/src/Ringtoets.Common.IO/Ringtoets.Common.IO.csproj (.../Ringtoets.Common.IO.csproj) (revision 7594d7f46113b5c5f4f41bfbd0183a3789f648b9)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/Ringtoets.Common.IO.csproj (.../Ringtoets.Common.IO.csproj) (revision f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04)
@@ -62,7 +62,7 @@
-
+
Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/Exporters/CalculationConfigurationExporterTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.IO.Test/Exporters/CalculationConfigurationExporterTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/Exporters/CalculationConfigurationExporterTest.cs (revision f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04)
@@ -0,0 +1,174 @@
+// 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 System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Security.AccessControl;
+using System.Xml;
+using Core.Common.Base.IO;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.Calculation;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.IO.Exporters;
+using Ringtoets.Common.IO.Writers;
+
+namespace Ringtoets.Common.IO.Test.Exporters
+{
+ [TestFixture]
+ public class CalculationConfigurationExporterTest
+ {
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Call
+ var exporter = new SimpleCalculationConfigurationExporter(Enumerable.Empty(), "test.xml");
+
+ // Assert
+ Assert.IsInstanceOf(exporter);
+ }
+
+ [Test]
+ public void Constructor_ConfigurationNull_ThrowArgumentNullException()
+ {
+ // Call
+ TestDelegate test = () => new SimpleCalculationConfigurationExporter(null, "test.xml");
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("configuration", exception.ParamName);
+ }
+
+ [Test]
+ [TestCase("")]
+ [TestCase(" ")]
+ [TestCase("c:\\>")]
+ public void Constructor_FilePathInvalid_ThrowArgumentException(string filePath)
+ {
+ // Call
+ TestDelegate test = () => new SimpleCalculationConfigurationExporter(Enumerable.Empty(), filePath);
+
+ // Assert
+ Assert.Throws(test);
+ }
+
+ [Test]
+ public void Export_ValidData_ReturnTrueAndWritesFile()
+ {
+ // Setup
+ string targetFilePath = TestHelper.GetScratchPadPath($"{nameof(Export_ValidData_ReturnTrueAndWritesFile)}.xml");
+
+ string testFileSubPath = Path.Combine(
+ nameof(CalculationConfigurationExporter),
+ "folderWithSubfolderAndCalculation.xml");
+ string expectedXmlFilePath = TestHelper.GetTestDataPath(
+ TestDataPath.Ringtoets.Common.IO,
+ testFileSubPath);
+
+ var calculation = new TestCalculation("Calculation A");
+ var calculation2 = new TestCalculation("Calculation B");
+
+ var calculationGroup2 = new CalculationGroup("Group B", false)
+ {
+ Children =
+ {
+ calculation2
+ }
+ };
+
+ var calculationGroup = new CalculationGroup("Group A", false)
+ {
+ Children =
+ {
+ calculation,
+ calculationGroup2
+ }
+ };
+
+ var exporter = new SimpleCalculationConfigurationExporter(new[]
+ {
+ calculationGroup
+ }, targetFilePath);
+
+ try
+ {
+ // Call
+ bool isExported = exporter.Export();
+
+ // Assert
+ Assert.IsTrue(isExported);
+ Assert.IsTrue(File.Exists(targetFilePath));
+
+ string actualXml = File.ReadAllText(targetFilePath);
+ string expectedXml = File.ReadAllText(expectedXmlFilePath);
+
+ Assert.AreEqual(expectedXml, actualXml);
+ }
+ finally
+ {
+ File.Delete(targetFilePath);
+ }
+ }
+
+ [Test]
+ public void Export_InvalidDirectoryRights_LogErrorAndReturnFalse()
+ {
+ // Setup
+ string directoryPath = TestHelper.GetScratchPadPath(nameof(Export_InvalidDirectoryRights_LogErrorAndReturnFalse));
+ using (var disposeHelper = new DirectoryDisposeHelper(TestHelper.GetScratchPadPath(), nameof(Export_InvalidDirectoryRights_LogErrorAndReturnFalse)))
+ {
+ string filePath = Path.Combine(directoryPath, "test.xml");
+
+ var exporter = new SimpleCalculationConfigurationExporter(new[]
+ {
+ new TestCalculation("Calculation A")
+ }, filePath);
+
+ disposeHelper.LockDirectory(FileSystemRights.Write);
+
+ // Call
+ var isExported = true;
+ Action call = () => isExported = exporter.Export();
+
+ // Assert
+ string expectedMessage = $"Er is een onverwachte fout opgetreden tijdens het schrijven van het bestand '{filePath}'. "
+ + "Er is geen configuratie geëxporteerd.";
+ TestHelper.AssertLogMessageIsGenerated(call, expectedMessage);
+ Assert.IsFalse(isExported);
+ }
+ }
+ }
+
+ public class SimpleCalculationConfigurationExporter : CalculationConfigurationExporter
+ {
+ public SimpleCalculationConfigurationExporter(IEnumerable configuration, string targetFilePath) : base(configuration, targetFilePath) {}
+ }
+
+ public class SimpleCalculationConfigurationWriter : CalculationConfigurationWriter
+ {
+ protected override void WriteCalculation(TestCalculation calculation, XmlWriter writer)
+ {
+ writer.WriteElementString("calculation", calculation.Name);
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04 refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.IO.Test/Exporters/ConfigurationExporterTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/Ringtoets.Common.IO.Test.csproj
===================================================================
diff -u -r7594d7f46113b5c5f4f41bfbd0183a3789f648b9 -rf9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04
--- Ringtoets/Common/test/Ringtoets.Common.IO.Test/Ringtoets.Common.IO.Test.csproj (.../Ringtoets.Common.IO.Test.csproj) (revision 7594d7f46113b5c5f4f41bfbd0183a3789f648b9)
+++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/Ringtoets.Common.IO.Test.csproj (.../Ringtoets.Common.IO.Test.csproj) (revision f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04)
@@ -65,7 +65,7 @@
-
+
Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/test-data/CalculationConfigurationExporter/folderWithSubfolderAndCalculation.xml
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.IO.Test/test-data/CalculationConfigurationExporter/folderWithSubfolderAndCalculation.xml (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/test-data/CalculationConfigurationExporter/folderWithSubfolderAndCalculation.xml (revision f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04)
@@ -0,0 +1,9 @@
+
+
+
+
\ No newline at end of file
Fisheye: Tag f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04 refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.IO.Test/test-data/ConfigurationExporter/folderWithSubfolderAndCalculation.xml'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/GrassCoverErosionInwardsCalculationConfigurationExporter.cs
===================================================================
diff -u
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/GrassCoverErosionInwardsCalculationConfigurationExporter.cs (revision 0)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/GrassCoverErosionInwardsCalculationConfigurationExporter.cs (revision f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04)
@@ -0,0 +1,47 @@
+// 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 System.Collections.Generic;
+using Ringtoets.Common.Data.Calculation;
+using Ringtoets.Common.IO.Exporters;
+using Ringtoets.GrassCoverErosionInwards.Data;
+
+namespace Ringtoets.GrassCoverErosionInwards.IO
+{
+ ///
+ /// Exports a grass cover erosion inwards configuration and stores it as an XML file.
+ ///
+ public class GrassCoverErosionInwardsCalculationConfigurationExporter
+ : CalculationConfigurationExporter
+ {
+
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The configuration to export.
+ /// The path of the XML file to export to.
+ /// Thrown when is null.
+ /// Thrown when is invalid.
+ public GrassCoverErosionInwardsCalculationConfigurationExporter(IEnumerable configuration, string filePath)
+ : base(configuration, filePath) { }
+ }
+}
\ No newline at end of file
Fisheye: Tag f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04 refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/GrassCoverErosionInwardsConfigurationExporter.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Ringtoets.GrassCoverErosionInwards.IO.csproj
===================================================================
diff -u -r9eb8e313e0f401980ca0a4b8015d23e8a12735f7 -rf9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Ringtoets.GrassCoverErosionInwards.IO.csproj (.../Ringtoets.GrassCoverErosionInwards.IO.csproj) (revision 9eb8e313e0f401980ca0a4b8015d23e8a12735f7)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.IO/Ringtoets.GrassCoverErosionInwards.IO.csproj (.../Ringtoets.GrassCoverErosionInwards.IO.csproj) (revision f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04)
@@ -40,7 +40,7 @@
Properties\GlobalAssembly.cs
-
+
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsPlugin.cs
===================================================================
diff -u -rea2a8559c7e3aa4fbb0379beade52581280064f2 -rf9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsPlugin.cs (.../GrassCoverErosionInwardsPlugin.cs) (revision ea2a8559c7e3aa4fbb0379beade52581280064f2)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsPlugin.cs (.../GrassCoverErosionInwardsPlugin.cs) (revision f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04)
@@ -34,7 +34,6 @@
using Ringtoets.Common.Data.DikeProfiles;
using Ringtoets.Common.Data.FailureMechanism;
using Ringtoets.Common.Data.Probability;
-using Ringtoets.Common.Forms;
using Ringtoets.Common.Forms.ChangeHandlers;
using Ringtoets.Common.Forms.Helpers;
using Ringtoets.Common.Forms.PresentationObjects;
@@ -83,14 +82,14 @@
{
FileFilterGenerator = new FileFilterGenerator(RingtoetsCommonFormsResources.DataTypeDisplayName_xml_file_filter_Extension,
RingtoetsCommonFormsResources.DataTypeDisplayName_xml_file_filter_Description),
- CreateFileExporter = (context, filePath) => new GrassCoverErosionInwardsConfigurationExporter(context.WrappedData.Children, filePath),
+ CreateFileExporter = (context, filePath) => new GrassCoverErosionInwardsCalculationConfigurationExporter(context.WrappedData.Children, filePath),
IsEnabled = context => context.WrappedData.Children.Any()
};
yield return new ExportInfo
{
FileFilterGenerator = new FileFilterGenerator(RingtoetsCommonFormsResources.DataTypeDisplayName_xml_file_filter_Extension,
RingtoetsCommonFormsResources.DataTypeDisplayName_xml_file_filter_Description),
- CreateFileExporter = (context, filePath) => new GrassCoverErosionInwardsConfigurationExporter(new[]
+ CreateFileExporter = (context, filePath) => new GrassCoverErosionInwardsCalculationConfigurationExporter(new[]
{
context.WrappedData
}, filePath),
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/GrassCoverErosionInwardsCalculationConfigurationExporterTest.cs
===================================================================
diff -u
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/GrassCoverErosionInwardsCalculationConfigurationExporterTest.cs (revision 0)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/GrassCoverErosionInwardsCalculationConfigurationExporterTest.cs (revision f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04)
@@ -0,0 +1,139 @@
+// 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 System.IO;
+using System.Linq;
+using System.Security.AccessControl;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.Calculation;
+using Ringtoets.Common.IO.Exporters;
+using Ringtoets.GrassCoverErosionInwards.Data;
+
+namespace Ringtoets.GrassCoverErosionInwards.IO.Test
+{
+ [TestFixture]
+ public class GrassCoverErosionInwardsCalculationConfigurationExporterTest
+ {
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Call
+ var exporter = new GrassCoverErosionInwardsCalculationConfigurationExporter(Enumerable.Empty(), "test.xml");
+
+ // Assert
+ Assert.IsInstanceOf<
+ CalculationConfigurationExporter<
+ GrassCoverErosionInwardsCalculationConfigurationWriter,
+ GrassCoverErosionInwardsCalculation>>(exporter);
+ }
+
+ [Test]
+ public void Export_ValidData_ReturnTrueAndWritesFile()
+ {
+ // Setup
+ string filePath = TestHelper.GetScratchPadPath($"{nameof(Export_ValidData_ReturnTrueAndWritesFile)}.xml");
+
+ GrassCoverErosionInwardsCalculation calculation = new GrassCoverErosionInwardsCalculation
+ {
+ Name = "Berekening 1"
+ };
+ GrassCoverErosionInwardsCalculation calculation2 = new GrassCoverErosionInwardsCalculation
+ {
+ Name = "Berekening 2"
+ };
+
+ var calculationGroup2 = new CalculationGroup("Nested", false)
+ {
+ Children =
+ {
+ calculation2
+ }
+ };
+
+ var calculationGroup = new CalculationGroup("Testmap", false)
+ {
+ Children =
+ {
+ calculation,
+ calculationGroup2
+ }
+ };
+
+ var exporter = new GrassCoverErosionInwardsCalculationConfigurationExporter(new[]
+ {
+ calculationGroup
+ }, filePath);
+
+ try
+ {
+ // Call
+ bool isExported = exporter.Export();
+
+ // Assert
+ Assert.IsTrue(isExported);
+ Assert.IsTrue(File.Exists(filePath));
+
+ string actualXml = File.ReadAllText(filePath);
+ string expectedXmlFilePath = TestHelper.GetTestDataPath(
+ TestDataPath.Ringtoets.GrassCoverErosionInwards.IO,
+ Path.Combine(nameof(GrassCoverErosionInwardsCalculationConfigurationExporter), "folderWithSubfolderAndCalculation.xml"));
+
+ string expectedXml = File.ReadAllText(expectedXmlFilePath);
+
+ Assert.AreEqual(expectedXml, actualXml);
+ }
+ finally
+ {
+ File.Delete(filePath);
+ }
+ }
+
+ [Test]
+ public void Export_InvalidDirectoryRights_LogErrorAndReturnFalse()
+ {
+ // Setup
+ string directoryPath = TestHelper.GetScratchPadPath(nameof(Export_InvalidDirectoryRights_LogErrorAndReturnFalse));
+ using (var disposeHelper = new DirectoryDisposeHelper(TestHelper.GetScratchPadPath(), nameof(Export_InvalidDirectoryRights_LogErrorAndReturnFalse)))
+ {
+ string filePath = Path.Combine(directoryPath, "test.xml");
+
+ var exporter = new GrassCoverErosionInwardsCalculationConfigurationExporter(new[]
+ {
+ new GrassCoverErosionInwardsCalculation()
+ }, filePath);
+
+ disposeHelper.LockDirectory(FileSystemRights.Write);
+
+ // Call
+ var isExported = true;
+ Action call = () => isExported = exporter.Export();
+
+ // Assert
+ string expectedMessage = $"Er is een onverwachte fout opgetreden tijdens het schrijven van het bestand '{filePath}'. "
+ + "Er is geen configuratie geëxporteerd.";
+ TestHelper.AssertLogMessageIsGenerated(call, expectedMessage);
+ Assert.IsFalse(isExported);
+ }
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04 refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/GrassCoverErosionInwardsConfigurationExporterTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/Ringtoets.GrassCoverErosionInwards.IO.Test.csproj
===================================================================
diff -u -r9eb8e313e0f401980ca0a4b8015d23e8a12735f7 -rf9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/Ringtoets.GrassCoverErosionInwards.IO.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.IO.Test.csproj) (revision 9eb8e313e0f401980ca0a4b8015d23e8a12735f7)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/Ringtoets.GrassCoverErosionInwards.IO.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.IO.Test.csproj) (revision f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04)
@@ -50,7 +50,7 @@
Properties\GlobalAssembly.cs
-
+
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/test-data/GrassCoverErosionInwardsCalculationConfigurationExporter/folderWithSubfolderAndCalculation.xml
===================================================================
diff -u
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/test-data/GrassCoverErosionInwardsCalculationConfigurationExporter/folderWithSubfolderAndCalculation.xml (revision 0)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/test-data/GrassCoverErosionInwardsCalculationConfigurationExporter/folderWithSubfolderAndCalculation.xml (revision f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04)
@@ -0,0 +1,37 @@
+
+
+
+
+ NaN
+
+ false
+ havendam
+ 0
+ false
+
+
+
+ 0.004
+ 0.0006
+
+
+
+
+
+ NaN
+
+ false
+ havendam
+ 0
+ false
+
+
+
+ 0.004
+ 0.0006
+
+
+
+
+
+
\ No newline at end of file
Fisheye: Tag f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04 refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.IO.Test/test-data/GrassCoverErosionInwardsConfigurationExporter/folderWithSubfolderAndCalculation.xml'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/ExportInfos/GrassCoverErosionInwardsCalculationContextExportInfoTest.cs
===================================================================
diff -u -r69eb17523e5ae490637e29718a4a563cbcaacc3c -rf9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/ExportInfos/GrassCoverErosionInwardsCalculationContextExportInfoTest.cs (.../GrassCoverErosionInwardsCalculationContextExportInfoTest.cs) (revision 69eb17523e5ae490637e29718a4a563cbcaacc3c)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/ExportInfos/GrassCoverErosionInwardsCalculationContextExportInfoTest.cs (.../GrassCoverErosionInwardsCalculationContextExportInfoTest.cs) (revision f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04)
@@ -74,7 +74,7 @@
IFileExporter fileExporter = info.CreateFileExporter(context, "test");
// Assert
- Assert.IsInstanceOf(fileExporter);
+ Assert.IsInstanceOf(fileExporter);
}
mocks.VerifyAll();
}
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/ExportInfos/GrassCoverErosionInwardsCalculationGroupContextExportInfoTest.cs
===================================================================
diff -u -r0d29de0eb92a426c8e1b3725656a3f608b93f951 -rf9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/ExportInfos/GrassCoverErosionInwardsCalculationGroupContextExportInfoTest.cs (.../GrassCoverErosionInwardsCalculationGroupContextExportInfoTest.cs) (revision 0d29de0eb92a426c8e1b3725656a3f608b93f951)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Plugin.Test/ExportInfos/GrassCoverErosionInwardsCalculationGroupContextExportInfoTest.cs (.../GrassCoverErosionInwardsCalculationGroupContextExportInfoTest.cs) (revision f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04)
@@ -76,7 +76,7 @@
IFileExporter fileExporter = info.CreateFileExporter(context, "test");
// Assert
- Assert.IsInstanceOf(fileExporter);
+ Assert.IsInstanceOf(fileExporter);
}
mocks.VerifyAll();
}
Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.IO/GrassCoverErosionOutwardsCalculationConfigurationExporter.cs
===================================================================
diff -u
--- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.IO/GrassCoverErosionOutwardsCalculationConfigurationExporter.cs (revision 0)
+++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.IO/GrassCoverErosionOutwardsCalculationConfigurationExporter.cs (revision f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04)
@@ -0,0 +1,46 @@
+// 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 System.Collections.Generic;
+using Ringtoets.Common.Data.Calculation;
+using Ringtoets.Common.IO.Exporters;
+using Ringtoets.GrassCoverErosionOutwards.Data;
+
+namespace Ringtoets.GrassCoverErosionOutwards.IO
+{
+ ///
+ /// Exports a grass cover erosion outwards configuration and stores it as an XML file.
+ ///
+ public class GrassCoverErosionOutwardsCalculationConfigurationExporter
+ : CalculationConfigurationExporter
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The configuration to export.
+ /// The path of the XML file to export to.
+ /// Thrown when is null.
+ /// Thrown when is invalid.
+ public GrassCoverErosionOutwardsCalculationConfigurationExporter(IEnumerable configuration, string filePath)
+ : base(configuration, filePath) {}
+ }
+}
\ No newline at end of file
Fisheye: Tag f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04 refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.IO/GrassCoverErosionOutwardsConfigurationExporter.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.IO/Ringtoets.GrassCoverErosionOutwards.IO.csproj
===================================================================
diff -u -rf01786afaf51ad02f5be5e2a320461ebfe576bba -rf9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04
--- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.IO/Ringtoets.GrassCoverErosionOutwards.IO.csproj (.../Ringtoets.GrassCoverErosionOutwards.IO.csproj) (revision f01786afaf51ad02f5be5e2a320461ebfe576bba)
+++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.IO/Ringtoets.GrassCoverErosionOutwards.IO.csproj (.../Ringtoets.GrassCoverErosionOutwards.IO.csproj) (revision f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04)
@@ -44,7 +44,7 @@
Properties\GlobalAssembly.cs
-
+
Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs
===================================================================
diff -u -r4b68fcd10da185da7eef315c45d80a071c6e1bf5 -rf9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04
--- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs (.../GrassCoverErosionOutwardsPlugin.cs) (revision 4b68fcd10da185da7eef315c45d80a071c6e1bf5)
+++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs (.../GrassCoverErosionOutwardsPlugin.cs) (revision f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04)
@@ -286,7 +286,7 @@
yield return new ExportInfo
{
Name = RingtoetsCommonFormsResources.ConfigurationExporter_DisplayName,
- CreateFileExporter = (context, filePath) => new GrassCoverErosionOutwardsConfigurationExporter(context.WrappedData.Children, filePath),
+ CreateFileExporter = (context, filePath) => new GrassCoverErosionOutwardsCalculationConfigurationExporter(context.WrappedData.Children, filePath),
IsEnabled = context => context.WrappedData.Children.Any(),
FileFilterGenerator = new FileFilterGenerator(RingtoetsCommonFormsResources.DataTypeDisplayName_xml_file_filter_Extension,
RingtoetsCommonFormsResources.DataTypeDisplayName_xml_file_filter_Description)
@@ -307,7 +307,7 @@
yield return new ExportInfo
{
Name = RingtoetsCommonFormsResources.ConfigurationExporter_DisplayName,
- CreateFileExporter = (context, filePath) => new GrassCoverErosionOutwardsConfigurationExporter(new[]
+ CreateFileExporter = (context, filePath) => new GrassCoverErosionOutwardsCalculationConfigurationExporter(new[]
{
context.WrappedData
}, filePath),
Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.IO.Test/GrassCoverErosionOutwardsCalculationConfigurationExporterTest.cs
===================================================================
diff -u
--- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.IO.Test/GrassCoverErosionOutwardsCalculationConfigurationExporterTest.cs (revision 0)
+++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.IO.Test/GrassCoverErosionOutwardsCalculationConfigurationExporterTest.cs (revision f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04)
@@ -0,0 +1,120 @@
+// 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 System.Linq;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.Calculation;
+using Ringtoets.Common.Data.Hydraulics;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.IO.Exporters;
+using Ringtoets.GrassCoverErosionOutwards.Data;
+
+namespace Ringtoets.GrassCoverErosionOutwards.IO.Test
+{
+ [TestFixture]
+ public class GrassCoverErosionOutwardsCalculationConfigurationExporterTest
+ {
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Call
+ var exporter = new GrassCoverErosionOutwardsCalculationConfigurationExporter(Enumerable.Empty(), "test.xml");
+
+ // Assert
+ Assert.IsInstanceOf<
+ CalculationConfigurationExporter<
+ GrassCoverErosionOutwardsCalculationConfigurationWriter,
+ GrassCoverErosionOutwardsWaveConditionsCalculation>>(exporter);
+ }
+
+ [Test]
+ public void Export_ValidData_ReturnTrueAndWritesFile()
+ {
+ // Setup
+ string filePath = TestHelper.GetScratchPadPath($"{nameof(Export_ValidData_ReturnTrueAndWritesFile)}.xml");
+
+ var calculation1 = new GrassCoverErosionOutwardsWaveConditionsCalculation
+ {
+ Name = "Calculation A",
+ InputParameters =
+ {
+ ForeshoreProfile = new TestForeshoreProfile("ForeshoreA")
+ }
+ };
+
+ var calculation2 = new GrassCoverErosionOutwardsWaveConditionsCalculation
+ {
+ Name = "PK001_0002 W1-6_4_1D1",
+ InputParameters =
+ {
+ HydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "HydraulicLocationA", 0, 0),
+ UseBreakWater = true
+ }
+ };
+
+ var calculationGroup2 = new CalculationGroup("PK001_0002", false)
+ {
+ Children =
+ {
+ calculation2
+ }
+ };
+
+ var calculationGroup = new CalculationGroup("PK001_0001", false)
+ {
+ Children =
+ {
+ calculation1,
+ calculationGroup2
+ }
+ };
+
+ var exporter = new GrassCoverErosionOutwardsCalculationConfigurationExporter(new []
+ {
+ calculationGroup
+ }, filePath);
+
+ try
+ {
+ // Call
+ bool isExported = exporter.Export();
+
+ // Assert
+ Assert.IsTrue(isExported);
+ Assert.IsTrue(File.Exists(filePath));
+
+ string actualXml = File.ReadAllText(filePath);
+ string testDirSubPath = Path.Combine(nameof(GrassCoverErosionOutwardsCalculationConfigurationExporter), "fullValidConfiguration.xml");
+ string expectedXmlFilePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.GrassCoverErosionOutwards.IO,
+ testDirSubPath);
+ string expectedXml = File.ReadAllText(expectedXmlFilePath);
+
+ Assert.AreEqual(expectedXml, actualXml);
+ }
+ finally
+ {
+ File.Delete(filePath);
+ }
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04 refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.IO.Test/GrassCoverErosionOutwardsConfigurationExporterTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.IO.Test/Ringtoets.GrassCoverErosionOutwards.IO.Test.csproj
===================================================================
diff -u -rf01786afaf51ad02f5be5e2a320461ebfe576bba -rf9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04
--- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.IO.Test/Ringtoets.GrassCoverErosionOutwards.IO.Test.csproj (.../Ringtoets.GrassCoverErosionOutwards.IO.Test.csproj) (revision f01786afaf51ad02f5be5e2a320461ebfe576bba)
+++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.IO.Test/Ringtoets.GrassCoverErosionOutwards.IO.Test.csproj (.../Ringtoets.GrassCoverErosionOutwards.IO.Test.csproj) (revision f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04)
@@ -50,7 +50,7 @@
Properties\GlobalAssembly.cs
-
+
Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.IO.Test/test-data/GrassCoverErosionOutwardsCalculationConfigurationExporter/fullValidConfiguration.xml
===================================================================
diff -u
--- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.IO.Test/test-data/GrassCoverErosionOutwardsCalculationConfigurationExporter/fullValidConfiguration.xml (revision 0)
+++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.IO.Test/test-data/GrassCoverErosionOutwardsCalculationConfigurationExporter/fullValidConfiguration.xml (revision f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04)
@@ -0,0 +1,37 @@
+
+
+
+
+ NaN
+ NaN
+ NaN
+ NaN
+ 0.5
+ ForeshoreA
+ 0
+
+ false
+ havendam
+ 0
+ false
+
+
+
+
+ HydraulicLocationA
+ NaN
+ NaN
+ NaN
+ NaN
+ 0.5
+ NaN
+
+ true
+ havendam
+ 0
+ false
+
+
+
+
+
\ No newline at end of file
Fisheye: Tag f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04 refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.IO.Test/test-data/GrassCoverErosionOutwardsConfigurationExporter/fullValidConfiguration.xml'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/ExportInfos/GrassCoverErosionOutwardsWaveConditionsCalculationContextExportInfoTest.cs
===================================================================
diff -u -r4b68fcd10da185da7eef315c45d80a071c6e1bf5 -rf9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04
--- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/ExportInfos/GrassCoverErosionOutwardsWaveConditionsCalculationContextExportInfoTest.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculationContextExportInfoTest.cs) (revision 4b68fcd10da185da7eef315c45d80a071c6e1bf5)
+++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/ExportInfos/GrassCoverErosionOutwardsWaveConditionsCalculationContextExportInfoTest.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculationContextExportInfoTest.cs) (revision f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04)
@@ -173,7 +173,7 @@
IFileExporter fileExporter = configurationExportInfo.CreateFileExporter(context, "test");
// Assert
- Assert.IsInstanceOf(fileExporter);
+ Assert.IsInstanceOf(fileExporter);
mocks.VerifyAll();
}
Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/ExportInfos/GrassCoverErosionOutwardsWaveConditionsCalculationGroupContextExportInfoTest.cs
===================================================================
diff -u -r4b68fcd10da185da7eef315c45d80a071c6e1bf5 -rf9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04
--- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/ExportInfos/GrassCoverErosionOutwardsWaveConditionsCalculationGroupContextExportInfoTest.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculationGroupContextExportInfoTest.cs) (revision 4b68fcd10da185da7eef315c45d80a071c6e1bf5)
+++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/ExportInfos/GrassCoverErosionOutwardsWaveConditionsCalculationGroupContextExportInfoTest.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculationGroupContextExportInfoTest.cs) (revision f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04)
@@ -225,7 +225,7 @@
IFileExporter fileExporter = configurationExportInfo.CreateFileExporter(context, "test");
// Assert
- Assert.IsInstanceOf(fileExporter);
+ Assert.IsInstanceOf(fileExporter);
}
[Test]
Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/Exporters/PipingCalculationConfigurationExporter.cs
===================================================================
diff -u
--- Ringtoets/Piping/src/Ringtoets.Piping.IO/Exporters/PipingCalculationConfigurationExporter.cs (revision 0)
+++ Ringtoets/Piping/src/Ringtoets.Piping.IO/Exporters/PipingCalculationConfigurationExporter.cs (revision f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04)
@@ -0,0 +1,45 @@
+// 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 System.Collections.Generic;
+using Ringtoets.Common.Data.Calculation;
+using Ringtoets.Common.IO.Exporters;
+using Ringtoets.Piping.Data;
+
+namespace Ringtoets.Piping.IO.Exporters
+{
+ ///
+ /// Exports a piping configuration and stores it as an XML file.
+ ///
+ public class PipingCalculationConfigurationExporter : CalculationConfigurationExporter
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The configuration to export.
+ /// The path of the XML file to export to.
+ /// Thrown when is null.
+ /// Thrown when is invalid.
+ public PipingCalculationConfigurationExporter(IEnumerable configuration, string filePath) : base(configuration, filePath)
+ {}
+ }
+}
\ No newline at end of file
Fisheye: Tag f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04 refers to a dead (removed) revision in file `Ringtoets/Piping/src/Ringtoets.Piping.IO/Exporters/PipingConfigurationExporter.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/Ringtoets.Piping.IO.csproj
===================================================================
diff -u -rf01786afaf51ad02f5be5e2a320461ebfe576bba -rf9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04
--- Ringtoets/Piping/src/Ringtoets.Piping.IO/Ringtoets.Piping.IO.csproj (.../Ringtoets.Piping.IO.csproj) (revision f01786afaf51ad02f5be5e2a320461ebfe576bba)
+++ Ringtoets/Piping/src/Ringtoets.Piping.IO/Ringtoets.Piping.IO.csproj (.../Ringtoets.Piping.IO.csproj) (revision f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04)
@@ -52,7 +52,7 @@
-
+
Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingPlugin.cs
===================================================================
diff -u -r00a4b6318d0d1ae57df5ef362ba1e8908aa330be -rf9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04
--- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingPlugin.cs (.../PipingPlugin.cs) (revision 00a4b6318d0d1ae57df5ef362ba1e8908aa330be)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingPlugin.cs (.../PipingPlugin.cs) (revision f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04)
@@ -140,7 +140,7 @@
yield return new ExportInfo
{
FileFilterGenerator = PipingConfigurationFileFilter,
- CreateFileExporter = (context, filePath) => new PipingConfigurationExporter(context.WrappedData.Children, filePath),
+ CreateFileExporter = (context, filePath) => new PipingCalculationConfigurationExporter(context.WrappedData.Children, filePath),
IsEnabled = context => context.WrappedData.Children.Any()
};
}
Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Exporters/PipingCalculationConfigurationExporterTest.cs
===================================================================
diff -u
--- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Exporters/PipingCalculationConfigurationExporterTest.cs (revision 0)
+++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Exporters/PipingCalculationConfigurationExporterTest.cs (revision f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04)
@@ -0,0 +1,149 @@
+// 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 System.IO;
+using System.Linq;
+using System.Security.AccessControl;
+using Core.Common.Base.Data;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.Calculation;
+using Ringtoets.Common.Data.Hydraulics;
+using Ringtoets.Common.IO.Exporters;
+using Ringtoets.Piping.Data;
+using Ringtoets.Piping.Integration.TestUtils;
+using Ringtoets.Piping.IO.Exporters;
+using Ringtoets.Piping.Primitives;
+
+namespace Ringtoets.Piping.IO.Test.Exporters
+{
+ [TestFixture]
+ public class PipingCalculationConfigurationExporterTest
+ {
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Call
+ var exporter = new PipingCalculationConfigurationExporter(Enumerable.Empty(), "test.xml");
+
+ // Assert
+ Assert.IsInstanceOf>(exporter);
+ }
+
+ [Test]
+ public void Export_ValidData_ReturnTrueAndWritesFile()
+ {
+ // Setup
+ string filePath = TestHelper.GetScratchPadPath($"{nameof(Export_ValidData_ReturnTrueAndWritesFile)}.xml");
+
+ PipingCalculation calculation = PipingTestDataGenerator.GetPipingCalculation();
+ calculation.InputParameters.EntryPointL = (RoundedDouble) 0.1;
+ calculation.InputParameters.ExitPointL = (RoundedDouble) 0.2;
+
+ PipingCalculation calculation2 = PipingTestDataGenerator.GetPipingCalculation();
+ calculation2.Name = "PK001_0002 W1-6_4_1D1";
+ calculation2.InputParameters.HydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "PUNT_SCH_17", 0, 0);
+ calculation2.InputParameters.SurfaceLine.Name = "PK001_0002";
+ calculation2.InputParameters.EntryPointL = (RoundedDouble) 0.3;
+ calculation2.InputParameters.ExitPointL = (RoundedDouble) 0.4;
+ calculation2.InputParameters.StochasticSoilModel = new StochasticSoilModel(1, "PK001_0002_Piping", string.Empty);
+ calculation2.InputParameters.StochasticSoilProfile = new StochasticSoilProfile(0, SoilProfileType.SoilProfile1D, 0)
+ {
+ SoilProfile = new PipingSoilProfile("W1-6_4_1D1", 0, new[]
+ {
+ new PipingSoilLayer(0)
+ }, SoilProfileType.SoilProfile1D, 0)
+ };
+
+ var calculationGroup2 = new CalculationGroup("PK001_0002", false)
+ {
+ Children =
+ {
+ calculation2
+ }
+ };
+
+ var calculationGroup = new CalculationGroup("PK001_0001", false)
+ {
+ Children =
+ {
+ calculation,
+ calculationGroup2
+ }
+ };
+
+ var exporter = new PipingCalculationConfigurationExporter(new []
+ {
+ calculationGroup
+ }, filePath);
+
+ try
+ {
+ // Call
+ bool isExported = exporter.Export();
+
+ // Assert
+ Assert.IsTrue(isExported);
+ Assert.IsTrue(File.Exists(filePath));
+
+ string actualXml = File.ReadAllText(filePath);
+ string expectedXmlFilePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Piping.IO,
+ Path.Combine("PipingCalculationConfigurationWriter", "folderWithSubfolderAndCalculation.xml"));
+ string expectedXml = File.ReadAllText(expectedXmlFilePath);
+
+ Assert.AreEqual(expectedXml, actualXml);
+ }
+ finally
+ {
+ File.Delete(filePath);
+ }
+ }
+
+ [Test]
+ public void Export_InvalidDirectoryRights_LogErrorAndReturnFalse()
+ {
+ // Setup
+ string directoryPath = TestHelper.GetScratchPadPath(nameof(Export_InvalidDirectoryRights_LogErrorAndReturnFalse));
+ using (var disposeHelper = new DirectoryDisposeHelper(TestHelper.GetScratchPadPath(), nameof(Export_InvalidDirectoryRights_LogErrorAndReturnFalse)))
+ {
+ string filePath = Path.Combine(directoryPath, "test.xml");
+
+ var exporter = new PipingCalculationConfigurationExporter(new []
+ {
+ PipingTestDataGenerator.GetPipingCalculation()
+ }, filePath);
+
+ disposeHelper.LockDirectory(FileSystemRights.Write);
+
+ // Call
+ var isExported = true;
+ Action call = () => isExported = exporter.Export();
+
+ // Assert
+ string expectedMessage = $"Er is een onverwachte fout opgetreden tijdens het schrijven van het bestand '{filePath}'. "
+ + "Er is geen configuratie geëxporteerd.";
+ TestHelper.AssertLogMessageIsGenerated(call, expectedMessage);
+ Assert.IsFalse(isExported);
+ }
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04 refers to a dead (removed) revision in file `Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Exporters/PipingConfigurationExporterTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Ringtoets.Piping.IO.Test.csproj
===================================================================
diff -u -rf01786afaf51ad02f5be5e2a320461ebfe576bba -rf9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04
--- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Ringtoets.Piping.IO.Test.csproj (.../Ringtoets.Piping.IO.Test.csproj) (revision f01786afaf51ad02f5be5e2a320461ebfe576bba)
+++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Ringtoets.Piping.IO.Test.csproj (.../Ringtoets.Piping.IO.Test.csproj) (revision f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04)
@@ -72,7 +72,7 @@
-
+
Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/ExportInfos/PipingCalculationGroupContextExportInfoTest.cs
===================================================================
diff -u -r3c283d1bc64a0dcc92291152963be2a9e6b8108f -rf9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04
--- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/ExportInfos/PipingCalculationGroupContextExportInfoTest.cs (.../PipingCalculationGroupContextExportInfoTest.cs) (revision 3c283d1bc64a0dcc92291152963be2a9e6b8108f)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/ExportInfos/PipingCalculationGroupContextExportInfoTest.cs (.../PipingCalculationGroupContextExportInfoTest.cs) (revision f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04)
@@ -78,7 +78,7 @@
IFileExporter fileExporter = info.CreateFileExporter(context, "test");
// Assert
- Assert.IsInstanceOf(fileExporter);
+ Assert.IsInstanceOf(fileExporter);
}
mocks.VerifyAll();
}
Index: Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.IO/Ringtoets.StabilityStoneCover.IO.csproj
===================================================================
diff -u -rf01786afaf51ad02f5be5e2a320461ebfe576bba -rf9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04
--- Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.IO/Ringtoets.StabilityStoneCover.IO.csproj (.../Ringtoets.StabilityStoneCover.IO.csproj) (revision f01786afaf51ad02f5be5e2a320461ebfe576bba)
+++ Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.IO/Ringtoets.StabilityStoneCover.IO.csproj (.../Ringtoets.StabilityStoneCover.IO.csproj) (revision f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04)
@@ -40,7 +40,7 @@
Properties\GlobalAssembly.cs
-
+
Index: Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.IO/StabilityStoneCoverCalculationConfigurationExporter.cs
===================================================================
diff -u
--- Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.IO/StabilityStoneCoverCalculationConfigurationExporter.cs (revision 0)
+++ Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.IO/StabilityStoneCoverCalculationConfigurationExporter.cs (revision f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04)
@@ -0,0 +1,46 @@
+// 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 System.Collections.Generic;
+using Ringtoets.Common.Data.Calculation;
+using Ringtoets.Common.IO.Exporters;
+using Ringtoets.StabilityStoneCover.Data;
+
+namespace Ringtoets.StabilityStoneCover.IO
+{
+ ///
+ /// Exports a stability stone cover configuration and stores it as an XML file.
+ ///
+ public class StabilityStoneCoverCalculationConfigurationExporter
+ : CalculationConfigurationExporter
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The configuration to export.
+ /// The path of the XML file to export to.
+ /// Thrown when is null.
+ /// Thrown when is invalid.
+ public StabilityStoneCoverCalculationConfigurationExporter(IEnumerable configuration, string filePath)
+ : base(configuration, filePath) {}
+ }
+}
\ No newline at end of file
Fisheye: Tag f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04 refers to a dead (removed) revision in file `Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.IO/StabilityStoneCoverConfigurationExporter.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Plugin/StabilityStoneCoverPlugin.cs
===================================================================
diff -u -r4b68fcd10da185da7eef315c45d80a071c6e1bf5 -rf9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04
--- Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Plugin/StabilityStoneCoverPlugin.cs (.../StabilityStoneCoverPlugin.cs) (revision 4b68fcd10da185da7eef315c45d80a071c6e1bf5)
+++ Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Plugin/StabilityStoneCoverPlugin.cs (.../StabilityStoneCoverPlugin.cs) (revision f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04)
@@ -166,7 +166,7 @@
yield return new ExportInfo
{
Name = RingtoetsCommonFormsResources.ConfigurationExporter_DisplayName,
- CreateFileExporter = (context, filePath) => new StabilityStoneCoverConfigurationExporter(context.WrappedData.Children, filePath),
+ CreateFileExporter = (context, filePath) => new StabilityStoneCoverCalculationConfigurationExporter(context.WrappedData.Children, filePath),
IsEnabled = context => context.WrappedData.Children.Any(),
FileFilterGenerator = new FileFilterGenerator(
RingtoetsCommonFormsResources.DataTypeDisplayName_xml_file_filter_Extension,
@@ -189,7 +189,7 @@
yield return new ExportInfo
{
Name = RingtoetsCommonFormsResources.ConfigurationExporter_DisplayName,
- CreateFileExporter = (context, filePath) => new StabilityStoneCoverConfigurationExporter(new [] { context.WrappedData }, filePath),
+ CreateFileExporter = (context, filePath) => new StabilityStoneCoverCalculationConfigurationExporter(new [] { context.WrappedData }, filePath),
FileFilterGenerator = new FileFilterGenerator(
RingtoetsCommonFormsResources.DataTypeDisplayName_xml_file_filter_Extension,
RingtoetsCommonFormsResources.DataTypeDisplayName_xml_file_filter_Description)
Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.IO.Test/Ringtoets.StabilityStoneCover.IO.Test.csproj
===================================================================
diff -u -rf01786afaf51ad02f5be5e2a320461ebfe576bba -rf9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04
--- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.IO.Test/Ringtoets.StabilityStoneCover.IO.Test.csproj (.../Ringtoets.StabilityStoneCover.IO.Test.csproj) (revision f01786afaf51ad02f5be5e2a320461ebfe576bba)
+++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.IO.Test/Ringtoets.StabilityStoneCover.IO.Test.csproj (.../Ringtoets.StabilityStoneCover.IO.Test.csproj) (revision f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04)
@@ -49,7 +49,7 @@
Properties\GlobalAssembly.cs
-
+
Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.IO.Test/StabilityStoneCoverCalculationConfigurationExporterTest.cs
===================================================================
diff -u
--- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.IO.Test/StabilityStoneCoverCalculationConfigurationExporterTest.cs (revision 0)
+++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.IO.Test/StabilityStoneCoverCalculationConfigurationExporterTest.cs (revision f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04)
@@ -0,0 +1,120 @@
+// 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 System.Linq;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.Calculation;
+using Ringtoets.Common.Data.Hydraulics;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.IO.Exporters;
+using Ringtoets.StabilityStoneCover.Data;
+
+namespace Ringtoets.StabilityStoneCover.IO.Test
+{
+ [TestFixture]
+ public class StabilityStoneCoverCalculationConfigurationExporterTest
+ {
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Call
+ var exporter = new StabilityStoneCoverCalculationConfigurationExporter(Enumerable.Empty(), "test.xml");
+
+ // Assert
+ Assert.IsInstanceOf<
+ CalculationConfigurationExporter<
+ StabilityStoneCoverCalculationConfigurationWriter,
+ StabilityStoneCoverWaveConditionsCalculation>>(exporter);
+ }
+
+ [Test]
+ public void Export_ValidData_ReturnTrueAndWritesFile()
+ {
+ // Setup
+ string filePath = TestHelper.GetScratchPadPath($"{nameof(Export_ValidData_ReturnTrueAndWritesFile)}.xml");
+
+ var calculation1 = new StabilityStoneCoverWaveConditionsCalculation
+ {
+ Name = "Calculation A",
+ InputParameters =
+ {
+ ForeshoreProfile = new TestForeshoreProfile("ForeshoreA")
+ }
+ };
+
+ var calculation2 = new StabilityStoneCoverWaveConditionsCalculation
+ {
+ Name = "PK001_0002 W1-6_4_1D1",
+ InputParameters =
+ {
+ HydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "HydraulicLocationA", 0, 0),
+ UseBreakWater = true
+ }
+ };
+
+ var calculationGroup2 = new CalculationGroup("PK001_0002", false)
+ {
+ Children =
+ {
+ calculation2
+ }
+ };
+
+ var calculationGroup = new CalculationGroup("PK001_0001", false)
+ {
+ Children =
+ {
+ calculation1,
+ calculationGroup2
+ }
+ };
+
+ var exporter = new StabilityStoneCoverCalculationConfigurationExporter(new []
+ {
+ calculationGroup
+ }, filePath);
+
+ try
+ {
+ // Call
+ bool isExported = exporter.Export();
+
+ // Assert
+ Assert.IsTrue(isExported);
+ Assert.IsTrue(File.Exists(filePath));
+
+ string actualXml = File.ReadAllText(filePath);
+ string testDirSubPath = Path.Combine(nameof(StabilityStoneCoverCalculationConfigurationExporter), "fullValidConfiguration.xml");
+ string expectedXmlFilePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.StabilityStoneCover.IO,
+ testDirSubPath);
+ string expectedXml = File.ReadAllText(expectedXmlFilePath);
+
+ Assert.AreEqual(expectedXml, actualXml);
+ }
+ finally
+ {
+ File.Delete(filePath);
+ }
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04 refers to a dead (removed) revision in file `Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.IO.Test/StabilityStoneCoverConfigurationExporterTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.IO.Test/test-data/StabilityStoneCoverCalculationConfigurationExporter/fullValidConfiguration.xml
===================================================================
diff -u
--- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.IO.Test/test-data/StabilityStoneCoverCalculationConfigurationExporter/fullValidConfiguration.xml (revision 0)
+++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.IO.Test/test-data/StabilityStoneCoverCalculationConfigurationExporter/fullValidConfiguration.xml (revision f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04)
@@ -0,0 +1,37 @@
+
+
+
+
+ NaN
+ NaN
+ NaN
+ NaN
+ 0.5
+ ForeshoreA
+ 0
+
+ false
+ havendam
+ 0
+ false
+
+
+
+
+ HydraulicLocationA
+ NaN
+ NaN
+ NaN
+ NaN
+ 0.5
+ NaN
+
+ true
+ havendam
+ 0
+ false
+
+
+
+
+
\ No newline at end of file
Fisheye: Tag f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04 refers to a dead (removed) revision in file `Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.IO.Test/test-data/StabilityStoneCoverConfigurationExporter/fullValidConfiguration.xml'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/ExportInfos/StabilityStoneCoverWaveConditionsCalculationContextExportInfoTest.cs
===================================================================
diff -u -r69eb17523e5ae490637e29718a4a563cbcaacc3c -rf9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04
--- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/ExportInfos/StabilityStoneCoverWaveConditionsCalculationContextExportInfoTest.cs (.../StabilityStoneCoverWaveConditionsCalculationContextExportInfoTest.cs) (revision 69eb17523e5ae490637e29718a4a563cbcaacc3c)
+++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/ExportInfos/StabilityStoneCoverWaveConditionsCalculationContextExportInfoTest.cs (.../StabilityStoneCoverWaveConditionsCalculationContextExportInfoTest.cs) (revision f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04)
@@ -173,7 +173,7 @@
IFileExporter fileExporter = configurationExportInfo.CreateFileExporter(context, "test");
// Assert
- Assert.IsInstanceOf(fileExporter);
+ Assert.IsInstanceOf(fileExporter);
mocks.VerifyAll();
}
Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/ExportInfos/StabilityStoneCoverWaveConditionsCalculationGroupContextExportInfoTest.cs
===================================================================
diff -u -rd04efd93e668625dd987f6987e8273fc613a2f21 -rf9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04
--- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/ExportInfos/StabilityStoneCoverWaveConditionsCalculationGroupContextExportInfoTest.cs (.../StabilityStoneCoverWaveConditionsCalculationGroupContextExportInfoTest.cs) (revision d04efd93e668625dd987f6987e8273fc613a2f21)
+++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/ExportInfos/StabilityStoneCoverWaveConditionsCalculationGroupContextExportInfoTest.cs (.../StabilityStoneCoverWaveConditionsCalculationGroupContextExportInfoTest.cs) (revision f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04)
@@ -255,7 +255,7 @@
IFileExporter fileExporter = configurationExportInfo.CreateFileExporter(context, "test");
// Assert
- Assert.IsInstanceOf(fileExporter);
+ Assert.IsInstanceOf(fileExporter);
}
[Test]
Index: Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.IO/Ringtoets.WaveImpactAsphaltCover.IO.csproj
===================================================================
diff -u -rf01786afaf51ad02f5be5e2a320461ebfe576bba -rf9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04
--- Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.IO/Ringtoets.WaveImpactAsphaltCover.IO.csproj (.../Ringtoets.WaveImpactAsphaltCover.IO.csproj) (revision f01786afaf51ad02f5be5e2a320461ebfe576bba)
+++ Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.IO/Ringtoets.WaveImpactAsphaltCover.IO.csproj (.../Ringtoets.WaveImpactAsphaltCover.IO.csproj) (revision f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04)
@@ -40,7 +40,7 @@
Properties\GlobalAssembly.cs
-
+
Index: Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.IO/WaveImpactAsphaltCoverCalculationConfigurationExporter.cs
===================================================================
diff -u
--- Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.IO/WaveImpactAsphaltCoverCalculationConfigurationExporter.cs (revision 0)
+++ Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.IO/WaveImpactAsphaltCoverCalculationConfigurationExporter.cs (revision f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04)
@@ -0,0 +1,46 @@
+// 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 System.Collections.Generic;
+using Ringtoets.Common.Data.Calculation;
+using Ringtoets.Common.IO.Exporters;
+using Ringtoets.WaveImpactAsphaltCover.Data;
+
+namespace Ringtoets.WaveImpactAsphaltCover.IO
+{
+ ///
+ /// Exports a wave impact asphalt cover configuration and stores it as an XML file.
+ ///
+ public class WaveImpactAsphaltCoverCalculationConfigurationExporter
+ : CalculationConfigurationExporter
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The configuration to export.
+ /// The path of the XML file to export to.
+ /// Thrown when is null.
+ /// Thrown when is invalid.
+ public WaveImpactAsphaltCoverCalculationConfigurationExporter(IEnumerable configuration, string filePath)
+ : base(configuration, filePath) {}
+ }
+}
\ No newline at end of file
Fisheye: Tag f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04 refers to a dead (removed) revision in file `Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.IO/WaveImpactAsphaltCoverConfigurationExporter.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Plugin/WaveImpactAsphaltCoverPlugin.cs
===================================================================
diff -u -r4b68fcd10da185da7eef315c45d80a071c6e1bf5 -rf9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04
--- Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Plugin/WaveImpactAsphaltCoverPlugin.cs (.../WaveImpactAsphaltCoverPlugin.cs) (revision 4b68fcd10da185da7eef315c45d80a071c6e1bf5)
+++ Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Plugin/WaveImpactAsphaltCoverPlugin.cs (.../WaveImpactAsphaltCoverPlugin.cs) (revision f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04)
@@ -171,7 +171,7 @@
Name = RingtoetsCommonFormsResources.ConfigurationExporter_DisplayName,
CreateFileExporter = (context, filePath) =>
{
- return new WaveImpactAsphaltCoverConfigurationExporter(context.WrappedData.Children, filePath);
+ return new WaveImpactAsphaltCoverCalculationConfigurationExporter(context.WrappedData.Children, filePath);
},
IsEnabled = context => context.WrappedData.Children.Any(),
FileFilterGenerator = new FileFilterGenerator(RingtoetsCommonFormsResources.DataTypeDisplayName_xml_file_filter_Extension,
@@ -195,7 +195,7 @@
Name = RingtoetsCommonFormsResources.ConfigurationExporter_DisplayName,
CreateFileExporter = (context, filePath) =>
{
- return new WaveImpactAsphaltCoverConfigurationExporter(new [] { context.WrappedData }, filePath);
+ return new WaveImpactAsphaltCoverCalculationConfigurationExporter(new [] { context.WrappedData }, filePath);
},
FileFilterGenerator = new FileFilterGenerator(RingtoetsCommonFormsResources.DataTypeDisplayName_xml_file_filter_Extension,
RingtoetsCommonFormsResources.DataTypeDisplayName_xml_file_filter_Description)
Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.IO.Test/Ringtoets.WaveImpactAsphaltCover.IO.Test.csproj
===================================================================
diff -u -rf01786afaf51ad02f5be5e2a320461ebfe576bba -rf9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04
--- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.IO.Test/Ringtoets.WaveImpactAsphaltCover.IO.Test.csproj (.../Ringtoets.WaveImpactAsphaltCover.IO.Test.csproj) (revision f01786afaf51ad02f5be5e2a320461ebfe576bba)
+++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.IO.Test/Ringtoets.WaveImpactAsphaltCover.IO.Test.csproj (.../Ringtoets.WaveImpactAsphaltCover.IO.Test.csproj) (revision f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04)
@@ -49,7 +49,7 @@
Properties\GlobalAssembly.cs
-
+
Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.IO.Test/WaveImpactAsphaltCoverCalculationConfigurationExporterTest.cs
===================================================================
diff -u
--- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.IO.Test/WaveImpactAsphaltCoverCalculationConfigurationExporterTest.cs (revision 0)
+++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.IO.Test/WaveImpactAsphaltCoverCalculationConfigurationExporterTest.cs (revision f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04)
@@ -0,0 +1,120 @@
+// 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 System.Linq;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.Calculation;
+using Ringtoets.Common.Data.Hydraulics;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.IO.Exporters;
+using Ringtoets.WaveImpactAsphaltCover.Data;
+
+namespace Ringtoets.WaveImpactAsphaltCover.IO.Test
+{
+ [TestFixture]
+ public class WaveImpactAsphaltCoverCalculationConfigurationExporterTest
+ {
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Call
+ var exporter = new WaveImpactAsphaltCoverCalculationConfigurationExporter(Enumerable.Empty(), "test.xml");
+
+ // Assert
+ Assert.IsInstanceOf<
+ CalculationConfigurationExporter<
+ WaveImpactAsphaltCoverCalculationConfigurationWriter,
+ WaveImpactAsphaltCoverWaveConditionsCalculation>>(exporter);
+ }
+
+ [Test]
+ public void Export_ValidData_ReturnTrueAndWritesFile()
+ {
+ // Setup
+ string filePath = TestHelper.GetScratchPadPath($"{nameof(Export_ValidData_ReturnTrueAndWritesFile)}.xml");
+
+ var calculation1 = new WaveImpactAsphaltCoverWaveConditionsCalculation
+ {
+ Name = "Calculation A",
+ InputParameters =
+ {
+ ForeshoreProfile = new TestForeshoreProfile("ForeshoreA")
+ }
+ };
+
+ var calculation2 = new WaveImpactAsphaltCoverWaveConditionsCalculation
+ {
+ Name = "PK001_0002 W1-6_4_1D1",
+ InputParameters =
+ {
+ HydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "HydraulicLocationA", 0, 0),
+ UseBreakWater = true
+ }
+ };
+
+ var calculationGroup2 = new CalculationGroup("PK001_0002", false)
+ {
+ Children =
+ {
+ calculation2
+ }
+ };
+
+ var calculationGroup = new CalculationGroup("PK001_0001", false)
+ {
+ Children =
+ {
+ calculation1,
+ calculationGroup2
+ }
+ };
+
+ var exporter = new WaveImpactAsphaltCoverCalculationConfigurationExporter(new []
+ {
+ calculationGroup
+ }, filePath);
+
+ try
+ {
+ // Call
+ bool isExported = exporter.Export();
+
+ // Assert
+ Assert.IsTrue(isExported);
+ Assert.IsTrue(File.Exists(filePath));
+
+ string actualXml = File.ReadAllText(filePath);
+ string testDirSubPath = Path.Combine(nameof(WaveImpactAsphaltCoverCalculationConfigurationExporter), "fullValidConfiguration.xml");
+ string expectedXmlFilePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.WaveImpactAsphaltCover.IO,
+ testDirSubPath);
+ string expectedXml = File.ReadAllText(expectedXmlFilePath);
+
+ Assert.AreEqual(expectedXml, actualXml);
+ }
+ finally
+ {
+ File.Delete(filePath);
+ }
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04 refers to a dead (removed) revision in file `Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.IO.Test/WaveImpactAsphaltCoverConfigurationExporterTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.IO.Test/test-data/WaveImpactAsphaltCoverCalculationConfigurationExporter/fullValidConfiguration.xml
===================================================================
diff -u
--- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.IO.Test/test-data/WaveImpactAsphaltCoverCalculationConfigurationExporter/fullValidConfiguration.xml (revision 0)
+++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.IO.Test/test-data/WaveImpactAsphaltCoverCalculationConfigurationExporter/fullValidConfiguration.xml (revision f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04)
@@ -0,0 +1,37 @@
+
+
+
+
+ NaN
+ NaN
+ NaN
+ NaN
+ 0.5
+ ForeshoreA
+ 0
+
+ false
+ havendam
+ 0
+ false
+
+
+
+
+ HydraulicLocationA
+ NaN
+ NaN
+ NaN
+ NaN
+ 0.5
+ NaN
+
+ true
+ havendam
+ 0
+ false
+
+
+
+
+
\ No newline at end of file
Fisheye: Tag f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04 refers to a dead (removed) revision in file `Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.IO.Test/test-data/WaveImpactAsphaltCoverConfigurationExporter/fullValidConfiguration.xml'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/ExportInfos/WaveImpactAsphaltCoverWaveConditionsCalculationContextExportInfoTest.cs
===================================================================
diff -u -r4b68fcd10da185da7eef315c45d80a071c6e1bf5 -rf9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04
--- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/ExportInfos/WaveImpactAsphaltCoverWaveConditionsCalculationContextExportInfoTest.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationContextExportInfoTest.cs) (revision 4b68fcd10da185da7eef315c45d80a071c6e1bf5)
+++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/ExportInfos/WaveImpactAsphaltCoverWaveConditionsCalculationContextExportInfoTest.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationContextExportInfoTest.cs) (revision f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04)
@@ -173,7 +173,7 @@
IFileExporter fileExporter = configurationExportInfo.CreateFileExporter(context, "test");
// Assert
- Assert.IsInstanceOf(fileExporter);
+ Assert.IsInstanceOf(fileExporter);
mocks.VerifyAll();
}
Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/ExportInfos/WaveImpactAsphaltCoverWaveConditionsCalculationGroupContextExportInfoTest.cs
===================================================================
diff -u -r7348fb685e44d6eb4abf2854c8298c0a2189d67e -rf9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04
--- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/ExportInfos/WaveImpactAsphaltCoverWaveConditionsCalculationGroupContextExportInfoTest.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationGroupContextExportInfoTest.cs) (revision 7348fb685e44d6eb4abf2854c8298c0a2189d67e)
+++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/ExportInfos/WaveImpactAsphaltCoverWaveConditionsCalculationGroupContextExportInfoTest.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationGroupContextExportInfoTest.cs) (revision f9f7e585da06fc8ab1b8ab92ce4dd64bd66d8f04)
@@ -225,7 +225,7 @@
IFileExporter fileExporter = configurationExportInfo.CreateFileExporter(context, "test");
// Assert
- Assert.IsInstanceOf(fileExporter);
+ Assert.IsInstanceOf(fileExporter);
}
[Test]