Fisheye: Tag 7348fb685e44d6eb4abf2854c8298c0a2189d67e refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ExportInfos/WaveImpactAsphaltCoverWaveConditionsCalculationContextExportInfoTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 7348fb685e44d6eb4abf2854c8298c0a2189d67e refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ExportInfos/WaveImpactAsphaltCoverWaveConditionsCalculationGroupContextExportInfoTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj
===================================================================
diff -u -rd04efd93e668625dd987f6987e8273fc613a2f21 -r7348fb685e44d6eb4abf2854c8298c0a2189d67e
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision d04efd93e668625dd987f6987e8273fc613a2f21)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision 7348fb685e44d6eb4abf2854c8298c0a2189d67e)
@@ -75,8 +75,6 @@
-
-
Index: Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.IO/Ringtoets.WaveImpactAsphaltCover.IO.csproj
===================================================================
diff -u -r23d1e296e2da4364fbfe346e68d582dfcf966bb0 -r7348fb685e44d6eb4abf2854c8298c0a2189d67e
--- Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.IO/Ringtoets.WaveImpactAsphaltCover.IO.csproj (.../Ringtoets.WaveImpactAsphaltCover.IO.csproj) (revision 23d1e296e2da4364fbfe346e68d582dfcf966bb0)
+++ Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.IO/Ringtoets.WaveImpactAsphaltCover.IO.csproj (.../Ringtoets.WaveImpactAsphaltCover.IO.csproj) (revision 7348fb685e44d6eb4abf2854c8298c0a2189d67e)
@@ -34,11 +34,14 @@
+
Properties\GlobalAssembly.cs
+
+
@@ -63,6 +66,11 @@
Ringtoets.Common.DataFalse
+
+ {52ba7627-cbab-4209-be77-3b5f31378277}
+ Ringtoets.Common.IO
+ False
+ {87c2c553-c0bc-40bf-b1ea-b83bff357f27}Ringtoets.Revetment.Data
Index: Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.IO/WaveImpactAsphaltCoverConfigurationExporter.cs
===================================================================
diff -u
--- Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.IO/WaveImpactAsphaltCoverConfigurationExporter.cs (revision 0)
+++ Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.IO/WaveImpactAsphaltCoverConfigurationExporter.cs (revision 7348fb685e44d6eb4abf2854c8298c0a2189d67e)
@@ -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 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 WaveImpactAsphaltCoverConfigurationExporter
+ : ConfigurationExporter
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The calculation group to export.
+ /// The path of the XML file to export to.
+ /// Thrown when is null.
+ /// Thrown when is invalid.
+ public WaveImpactAsphaltCoverConfigurationExporter(CalculationGroup calculationGroup, string filePath)
+ : base(calculationGroup, filePath) {}
+ }
+}
\ No newline at end of file
Index: Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.IO/WaveImpactAsphaltCoverConfigurationWriter.cs
===================================================================
diff -u
--- Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.IO/WaveImpactAsphaltCoverConfigurationWriter.cs (revision 0)
+++ Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.IO/WaveImpactAsphaltCoverConfigurationWriter.cs (revision 7348fb685e44d6eb4abf2854c8298c0a2189d67e)
@@ -0,0 +1,40 @@
+// 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.Xml;
+using Ringtoets.Common.Data.Calculation;
+using Ringtoets.WaveImpactAsphaltCover.Data;
+using Ringtoets.Revetment.IO;
+
+namespace Ringtoets.WaveImpactAsphaltCover.IO
+{
+ ///
+ /// A writer for writing out configurations of and
+ /// , to XML format.
+ ///
+ public class WaveImpactAsphaltCoverConfigurationWriter : WaveConditionsInputConfigurationWriter
+ {
+ protected override void WriteCalculation(WaveImpactAsphaltCoverWaveConditionsCalculation calculation, XmlWriter writer)
+ {
+ WriteCalculation(calculation.Name, calculation.InputParameters, writer);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Plugin/Ringtoets.WaveImpactAsphaltCover.Plugin.csproj
===================================================================
diff -u -r7cc1fd960a912443ccc3c6995eccb5673d1d8d22 -r7348fb685e44d6eb4abf2854c8298c0a2189d67e
--- Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Plugin/Ringtoets.WaveImpactAsphaltCover.Plugin.csproj (.../Ringtoets.WaveImpactAsphaltCover.Plugin.csproj) (revision 7cc1fd960a912443ccc3c6995eccb5673d1d8d22)
+++ Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Plugin/Ringtoets.WaveImpactAsphaltCover.Plugin.csproj (.../Ringtoets.WaveImpactAsphaltCover.Plugin.csproj) (revision 7348fb685e44d6eb4abf2854c8298c0a2189d67e)
@@ -86,6 +86,11 @@
Ringtoets.Common.FormsFalse
+
+ {52BA7627-CBAB-4209-BE77-3B5F31378277}
+ Ringtoets.Common.IO
+ False
+ {d951d6da-fe83-4920-9fdb-63bf96480b54}Ringtoets.Common.Service
Index: Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Plugin/WaveImpactAsphaltCoverPlugin.cs
===================================================================
diff -u -r37fc59cc0f3becb92e14b8263bd8e9fc71aa0e79 -r7348fb685e44d6eb4abf2854c8298c0a2189d67e
--- Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Plugin/WaveImpactAsphaltCoverPlugin.cs (.../WaveImpactAsphaltCoverPlugin.cs) (revision 37fc59cc0f3becb92e14b8263bd8e9fc71aa0e79)
+++ Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Plugin/WaveImpactAsphaltCoverPlugin.cs (.../WaveImpactAsphaltCoverPlugin.cs) (revision 7348fb685e44d6eb4abf2854c8298c0a2189d67e)
@@ -155,6 +155,7 @@
{
yield return new ExportInfo
{
+ Name = RingtoetsCommonFormsResources.WaveConditionsExporter_DisplayName,
CreateFileExporter = (context, filePath) =>
{
var calculations = context.WrappedData.GetCalculations().Cast();
@@ -165,6 +166,18 @@
RingtoetsCommonFormsResources.DataTypeDisplayName_csv_file_filter_Description)
};
+ yield return new ExportInfo
+ {
+ Name = RingtoetsCommonFormsResources.ConfigurationExporter_DisplayName,
+ CreateFileExporter = (context, filePath) =>
+ {
+ return new WaveImpactAsphaltCoverConfigurationExporter(context.WrappedData, filePath);
+ },
+ IsEnabled = context => context.WrappedData.Children.Any(),
+ FileFilterGenerator = new FileFilterGenerator(RingtoetsCommonFormsResources.DataTypeDisplayName_xml_file_filter_Extension,
+ RingtoetsCommonFormsResources.DataTypeDisplayName_xml_file_filter_Description)
+ };
+
yield return new ExportInfo
{
CreateFileExporter = (context, filePath) => new WaveImpactAsphaltCoverWaveConditionsExporter(new[]
Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.IO.Test/Ringtoets.WaveImpactAsphaltCover.IO.Test.csproj
===================================================================
diff -u -r6a5d7b40b7ba4dcb73e393075338352d194e97c2 -r7348fb685e44d6eb4abf2854c8298c0a2189d67e
--- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.IO.Test/Ringtoets.WaveImpactAsphaltCover.IO.Test.csproj (.../Ringtoets.WaveImpactAsphaltCover.IO.Test.csproj) (revision 6a5d7b40b7ba4dcb73e393075338352d194e97c2)
+++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.IO.Test/Ringtoets.WaveImpactAsphaltCover.IO.Test.csproj (.../Ringtoets.WaveImpactAsphaltCover.IO.Test.csproj) (revision 7348fb685e44d6eb4abf2854c8298c0a2189d67e)
@@ -49,6 +49,8 @@
Properties\GlobalAssembly.cs
+
+
@@ -71,6 +73,18 @@
{d4200f43-3f72-4f42-af0a-8ced416a38ec}Ringtoets.Common.Data
+
+ {52ba7627-cbab-4209-be77-3b5f31378277}
+ Ringtoets.Common.IO
+
+
+ {4843D6E5-066F-4795-94F5-1D53932DD03C}
+ Ringtoets.Common.Data.TestUtil
+
+
+ {87C2C553-C0BC-40BF-B1EA-B83BFF357F27}
+ Ringtoets.Revetment.Data
+ {E3347B16-BB18-41C1-8D34-FBCBF20DB695}Ringtoets.Revetment.IO
Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.IO.Test/WaveImpactAsphaltCoverConfigurationExporterTest.cs
===================================================================
diff -u
--- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.IO.Test/WaveImpactAsphaltCoverConfigurationExporterTest.cs (revision 0)
+++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.IO.Test/WaveImpactAsphaltCoverConfigurationExporterTest.cs (revision 7348fb685e44d6eb4abf2854c8298c0a2189d67e)
@@ -0,0 +1,124 @@
+// 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.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 WaveImpactAsphaltCoverConfigurationExporterTest
+ {
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Call
+ var exporter = new WaveImpactAsphaltCoverConfigurationExporter(new CalculationGroup(), "test.xml");
+
+ // Assert
+ Assert.IsInstanceOf<
+ ConfigurationExporter<
+ WaveImpactAsphaltCoverConfigurationWriter,
+ 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 rootGroup = new CalculationGroup("root", false)
+ {
+ Children =
+ {
+ calculationGroup
+ }
+ };
+
+ var exporter = new WaveImpactAsphaltCoverConfigurationExporter(rootGroup, 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(WaveImpactAsphaltCoverConfigurationExporter), "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
Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.IO.Test/WaveImpactAsphaltCoverConfigurationWriterTest.cs
===================================================================
diff -u
--- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.IO.Test/WaveImpactAsphaltCoverConfigurationWriterTest.cs (revision 0)
+++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.IO.Test/WaveImpactAsphaltCoverConfigurationWriterTest.cs (revision 7348fb685e44d6eb4abf2854c8298c0a2189d67e)
@@ -0,0 +1,108 @@
+// 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.Data;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.Calculation;
+using Ringtoets.Common.Data.DikeProfiles;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.WaveImpactAsphaltCover.Data;
+using Ringtoets.Revetment.Data;
+using Ringtoets.Revetment.IO;
+
+namespace Ringtoets.WaveImpactAsphaltCover.IO.Test
+{
+ [TestFixture]
+ public class WaveImpactAsphaltCoverConfigurationWriterTest
+ {
+ [Test]
+ public void Constructor_Always_CreateWaveConditionsInputWriter()
+ {
+ // Call
+ var writer = new WaveImpactAsphaltCoverConfigurationWriter();
+
+ // Assert
+ Assert.IsInstanceOf>(writer);
+ }
+
+ [Test]
+ public void Write_GroupWithCalculationAndOtherGroup_WritesOutCalculationAndGroupToFile()
+ {
+ // Setup
+ string filePath = TestHelper.GetScratchPadPath("Write_GroupWithCalculationAndOtherGroup.xml");
+ string expectedXmlFilePath = TestHelper.GetTestDataPath(
+ TestDataPath.Ringtoets.WaveImpactAsphaltCover.IO,
+ Path.Combine(nameof(WaveImpactAsphaltCoverConfigurationWriter), "calculationAndGroupWithNesting.xml"));
+
+ var calculation = new WaveImpactAsphaltCoverWaveConditionsCalculation
+ {
+ Name = "Berekening 1",
+ InputParameters =
+ {
+ HydraulicBoundaryLocation = new TestHydraulicBoundaryLocation("hr_locatie_2"),
+ UpperBoundaryRevetment = (RoundedDouble) 2.5,
+ LowerBoundaryRevetment = (RoundedDouble) 1.3,
+ UpperBoundaryWaterLevels = (RoundedDouble) 2.2,
+ LowerBoundaryWaterLevels = (RoundedDouble) (-0.2),
+ StepSize = WaveConditionsInputStepSize.Two,
+ ForeshoreProfile = new TestForeshoreProfile("profiel2"),
+ Orientation = (RoundedDouble) 12.3,
+ UseForeshore = true,
+ UseBreakWater = true,
+ BreakWater =
+ {
+ Height = (RoundedDouble) 2.11,
+ Type = BreakWaterType.Wall
+ }
+ }
+ };
+
+ var calculationGroup = new CalculationGroup("NestedGroup", false);
+ var rootGroup = new CalculationGroup
+ {
+ Children =
+ {
+ calculation,
+ calculationGroup
+ }
+ };
+ try
+ {
+ var writer = new WaveImpactAsphaltCoverConfigurationWriter();
+
+ // Call
+ writer.Write(rootGroup, filePath);
+
+ // Assert
+ string actualXml = File.ReadAllText(filePath);
+ string expectedXml = File.ReadAllText(expectedXmlFilePath);
+
+ Assert.AreEqual(expectedXml, actualXml);
+ }
+ finally
+ {
+ File.Delete(filePath);
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.IO.Test/test-data/WaveImpactAsphaltCoverConfigurationExporter/fullValidConfiguration.xml
===================================================================
diff -u
--- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.IO.Test/test-data/WaveImpactAsphaltCoverConfigurationExporter/fullValidConfiguration.xml (revision 0)
+++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.IO.Test/test-data/WaveImpactAsphaltCoverConfigurationExporter/fullValidConfiguration.xml (revision 7348fb685e44d6eb4abf2854c8298c0a2189d67e)
@@ -0,0 +1,37 @@
+
+
+
+
\ No newline at end of file
Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.IO.Test/test-data/WaveImpactAsphaltCoverConfigurationWriter/calculationAndGroupWithNesting.xml
===================================================================
diff -u
--- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.IO.Test/test-data/WaveImpactAsphaltCoverConfigurationWriter/calculationAndGroupWithNesting.xml (revision 0)
+++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.IO.Test/test-data/WaveImpactAsphaltCoverConfigurationWriter/calculationAndGroupWithNesting.xml (revision 7348fb685e44d6eb4abf2854c8298c0a2189d67e)
@@ -0,0 +1,20 @@
+
+
+
+ hr_locatie_2
+ 2.5
+ 1.3
+ 2.2
+ -0.2
+ 2.0
+ profiel2
+ 12.3
+
+ true
+ verticalewand
+ 2.11
+ true
+
+
+
+
\ No newline at end of file
Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/ExportInfos/WaveImpactAsphaltCoverWaveConditionsCalculationContextExportInfoTest.cs
===================================================================
diff -u
--- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/ExportInfos/WaveImpactAsphaltCoverWaveConditionsCalculationContextExportInfoTest.cs (revision 0)
+++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/ExportInfos/WaveImpactAsphaltCoverWaveConditionsCalculationContextExportInfoTest.cs (revision 7348fb685e44d6eb4abf2854c8298c0a2189d67e)
@@ -0,0 +1,163 @@
+// 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.Linq;
+using Core.Common.Base.IO;
+using Core.Common.Gui;
+using Core.Common.Gui.Plugin;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Revetment.IO;
+using Ringtoets.Revetment.TestUtil;
+using Ringtoets.WaveImpactAsphaltCover.Data;
+using Ringtoets.WaveImpactAsphaltCover.Forms.PresentationObjects;
+
+namespace Ringtoets.WaveImpactAsphaltCover.Plugin.Test.ExportInfos
+{
+ [TestFixture]
+ public class WaveImpactAsphaltCoverWaveConditionsCalculationContextExportInfoTest
+ {
+ [Test]
+ public void Initialized_Always_ExpectedPropertiesSet()
+ {
+ // Setup
+ using (var plugin = new WaveImpactAsphaltCoverPlugin())
+ {
+ // Call
+ ExportInfo info = GetExportInfo(plugin);
+
+ // Assert
+ Assert.IsNotNull(info.CreateFileExporter);
+ Assert.IsNotNull(info.IsEnabled);
+ Assert.IsNull(info.Name);
+ Assert.IsNull(info.Category);
+ Assert.IsNull(info.Image);
+ Assert.IsNotNull(info.FileFilterGenerator);
+ }
+ }
+
+ [Test]
+ public void CreateFileExporter_Always_ReturnFileExporter()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
+
+ var context = new WaveImpactAsphaltCoverWaveConditionsCalculationContext(new WaveImpactAsphaltCoverWaveConditionsCalculation(),
+ failureMechanism, assessmentSection);
+ using (var plugin = new WaveImpactAsphaltCoverPlugin())
+ {
+ ExportInfo exportInfo = GetExportInfo(plugin);
+
+ // Call
+ IFileExporter fileExporter = exportInfo.CreateFileExporter(context, "test");
+
+ // Assert
+ Assert.IsInstanceOf(fileExporter);
+ }
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void FileFilterGenerator_Always_ReturnsFileFilter()
+ {
+ // Setup
+ using (var plugin = new WaveImpactAsphaltCoverPlugin())
+ {
+ ExportInfo exportInfo = GetExportInfo(plugin);
+
+ // Call
+ FileFilterGenerator fileFilterGenerator = exportInfo.FileFilterGenerator;
+
+ // Assert
+ Assert.AreEqual("Kommagescheiden bestand (*.csv)|*.csv", fileFilterGenerator.Filter);
+ }
+ }
+
+ [Test]
+ public void IsEnabled_WaveImpactAsphaltCoverWaveConditionsCalculationHasOutputFalse_ReturnsFalse()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
+
+ var context = new WaveImpactAsphaltCoverWaveConditionsCalculationContext(new WaveImpactAsphaltCoverWaveConditionsCalculation(),
+ failureMechanism, assessmentSection);
+ using (var plugin = new WaveImpactAsphaltCoverPlugin())
+ {
+ ExportInfo exportInfo = GetExportInfo(plugin);
+
+ // Call
+ bool isEnabled = exportInfo.IsEnabled(context);
+
+ // Assert
+ Assert.IsFalse(isEnabled);
+ }
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void IsEnabled_WaveImpactAsphaltCoverWaveConditionsCalculationHasOutputTrue_ReturnsTrue()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
+ var output = new[]
+ {
+ new TestWaveConditionsOutput()
+ };
+
+ var context = new WaveImpactAsphaltCoverWaveConditionsCalculationContext(
+ new WaveImpactAsphaltCoverWaveConditionsCalculation
+ {
+ Output = new WaveImpactAsphaltCoverWaveConditionsOutput(output)
+ },
+ failureMechanism, assessmentSection);
+
+ using (var plugin = new WaveImpactAsphaltCoverPlugin())
+ {
+ ExportInfo exportInfo = GetExportInfo(plugin);
+
+ // Call
+ bool isEnabled = exportInfo.IsEnabled(context);
+
+ // Assert
+ Assert.IsTrue(isEnabled);
+ }
+ mocks.VerifyAll();
+ }
+
+ private static ExportInfo GetExportInfo(WaveImpactAsphaltCoverPlugin plugin)
+ {
+ return plugin.GetExportInfos().First(ei => ei.DataType == typeof(WaveImpactAsphaltCoverWaveConditionsCalculationContext));
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/ExportInfos/WaveImpactAsphaltCoverWaveConditionsCalculationGroupContextExportInfoTest.cs
===================================================================
diff -u
--- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/ExportInfos/WaveImpactAsphaltCoverWaveConditionsCalculationGroupContextExportInfoTest.cs (revision 0)
+++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/ExportInfos/WaveImpactAsphaltCoverWaveConditionsCalculationGroupContextExportInfoTest.cs (revision 7348fb685e44d6eb4abf2854c8298c0a2189d67e)
@@ -0,0 +1,293 @@
+// 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.Linq;
+using Core.Common.Base.IO;
+using Core.Common.Gui;
+using Core.Common.Gui.Plugin;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.Calculation;
+using Ringtoets.Revetment.IO;
+using Ringtoets.Revetment.TestUtil;
+using Ringtoets.WaveImpactAsphaltCover.Data;
+using Ringtoets.WaveImpactAsphaltCover.Forms.PresentationObjects;
+using Ringtoets.WaveImpactAsphaltCover.IO;
+
+namespace Ringtoets.WaveImpactAsphaltCover.Plugin.Test.ExportInfos
+{
+ [TestFixture]
+ public class WaveImpactAsphaltCoverWaveConditionsCalculationGroupContextExportInfoTest
+ {
+ private ExportInfo waveConditionsExportInfo;
+ private ExportInfo configurationExportInfo;
+
+ [SetUp]
+ public void Setup()
+ {
+ using (var plugin = new WaveImpactAsphaltCoverPlugin())
+ {
+ ExportInfo[] exportInfos = plugin.GetExportInfos().Where(ei => ei.DataType == typeof(WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext)).ToArray();
+ waveConditionsExportInfo = exportInfos.Single(ei => ei.Name.Equals("Berekende belastingen bij verschillende waterstanden (*.csv)."));
+ configurationExportInfo = exportInfos.Single(ei => ei.Name.Equals("Ringtoets berekeningenconfiguratie (*.xml)"));
+ }
+ }
+
+ [Test]
+ public void WaveConditionsExportInfo_Initialized_ExpectedPropertiesSet()
+ {
+ // Assert
+ Assert.IsNotNull(waveConditionsExportInfo.CreateFileExporter);
+ Assert.IsNotNull(waveConditionsExportInfo.IsEnabled);
+ Assert.AreEqual("Berekende belastingen bij verschillende waterstanden (*.csv).", waveConditionsExportInfo.Name);
+ Assert.IsNull(waveConditionsExportInfo.Category);
+ Assert.IsNull(waveConditionsExportInfo.Image);
+ Assert.IsNotNull(waveConditionsExportInfo.FileFilterGenerator);
+ }
+
+ [Test]
+ public void WaveConditionsExportInfo_CreateFileExporter_ReturnFileExporter()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
+ var calculationGroup = new CalculationGroup();
+
+ var context = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(calculationGroup, failureMechanism, assessmentSection);
+
+ // Call
+ IFileExporter fileExporter = waveConditionsExportInfo.CreateFileExporter(context, "test");
+
+ // Assert
+ Assert.IsInstanceOf(fileExporter);
+
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void WaveConditionsExportInfo_FileFilterGenerator_ReturnsFileFilter()
+ {
+ // Call
+ FileFilterGenerator fileFilterGenerator = waveConditionsExportInfo.FileFilterGenerator;
+
+ // Assert
+ Assert.AreEqual("Kommagescheiden bestand (*.csv)|*.csv", fileFilterGenerator.Filter);
+ }
+
+ [Test]
+ public void WaveConditionsExportInfo_NoWaveImpactAsphaltCoverWaveConditionsCalculation_IsEnabledFalse()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
+ var calculationGroup = new CalculationGroup();
+
+ var context = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(calculationGroup, failureMechanism, assessmentSection);
+
+ // Call
+ bool isEnabled = waveConditionsExportInfo.IsEnabled(context);
+
+ // Assert
+ Assert.IsFalse(isEnabled);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void WaveConditionsExportInfo_CalculationWithOrWithoutOutput_IsEnabledTrueOrFalse(bool hasOutput)
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
+ var calculationGroup = new CalculationGroup();
+ var calculation = new WaveImpactAsphaltCoverWaveConditionsCalculation();
+
+ if (hasOutput)
+ {
+ var output = new[]
+ {
+ new TestWaveConditionsOutput()
+ };
+
+ calculation.Output = new WaveImpactAsphaltCoverWaveConditionsOutput(output);
+ }
+
+ calculationGroup.Children.Add(calculation);
+
+ var context = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(calculationGroup, failureMechanism, assessmentSection);
+
+ // Call
+ bool isEnabled = waveConditionsExportInfo.IsEnabled(context);
+
+ // Assert
+ Assert.AreEqual(hasOutput, isEnabled);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void WaveConditionsExportInfo_CalculationInSubFolder_IsEnabledTrueIfHasOutput(bool hasOutput)
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism();
+ var calculationGroup = new CalculationGroup();
+
+ WaveImpactAsphaltCoverWaveConditionsOutput WaveImpactAsphaltCoverWaveConditionsOutput = null;
+ if (hasOutput)
+ {
+ var output = new[]
+ {
+ new TestWaveConditionsOutput()
+ };
+ WaveImpactAsphaltCoverWaveConditionsOutput = new WaveImpactAsphaltCoverWaveConditionsOutput(output);
+ }
+ calculationGroup.Children.Add(
+ new CalculationGroup
+ {
+ Children =
+ {
+ new WaveImpactAsphaltCoverWaveConditionsCalculation
+ {
+ Output = WaveImpactAsphaltCoverWaveConditionsOutput
+ }
+ }
+ });
+
+ var context = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(calculationGroup, failureMechanism, assessmentSection);
+
+ // Call
+ bool isEnabled = waveConditionsExportInfo.IsEnabled(context);
+
+ // Assert
+ Assert.AreEqual(hasOutput, isEnabled);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void ConfigurationExportInfo_Initialized_ExpectedPropertiesSet()
+ {
+ // Assert
+ Assert.IsNotNull(configurationExportInfo.CreateFileExporter);
+ Assert.IsNotNull(configurationExportInfo.IsEnabled);
+ Assert.AreEqual("Ringtoets berekeningenconfiguratie (*.xml)", configurationExportInfo.Name);
+ Assert.IsNull(configurationExportInfo.Category);
+ Assert.IsNull(configurationExportInfo.Image);
+ Assert.IsNotNull(configurationExportInfo.FileFilterGenerator);
+ }
+
+ [Test]
+ public void ConfigurationExportInfo_CreateFileExporter_ReturnFileExporter()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var context = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(new CalculationGroup(),
+ new WaveImpactAsphaltCoverFailureMechanism(),
+ assessmentSection);
+
+ // Call
+ IFileExporter fileExporter = configurationExportInfo.CreateFileExporter(context, "test");
+
+ // Assert
+ Assert.IsInstanceOf(fileExporter);
+ }
+
+ [Test]
+ public void ConfigurationExportInfo_FileFilterGenerator_ReturnFileFilter()
+ {
+ // Call
+ FileFilterGenerator fileFilterGenerator = configurationExportInfo.FileFilterGenerator;
+
+ // Assert
+ Assert.AreEqual("Ringtoets berekeningenconfiguratie (*.xml)|*.xml", fileFilterGenerator.Filter);
+ }
+
+ [Test]
+ public void ConfigurationExportInfo_CalculationGroupNoChildren_IsEnabledFalse()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var context = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(new CalculationGroup(),
+ new WaveImpactAsphaltCoverFailureMechanism(),
+ assessmentSection);
+
+ // Call
+ bool isEnabled = configurationExportInfo.IsEnabled(context);
+
+ // Assert
+ Assert.IsFalse(isEnabled);
+ }
+
+ [Test]
+ [TestCase(true, false)]
+ [TestCase(false, true)]
+ public void ConfigurationExportInfo_CalculationGroupWithChildren_IsEnabledTrue(bool hasNestedGroup, bool hasCalculation)
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var assessmentSection = mocks.Stub();
+ mocks.ReplayAll();
+
+ var calculationGroup = new CalculationGroup();
+
+ if (hasNestedGroup)
+ {
+ calculationGroup.Children.Add(new CalculationGroup());
+ }
+
+ if (hasCalculation)
+ {
+ calculationGroup.Children.Add(new WaveImpactAsphaltCoverWaveConditionsCalculation());
+ }
+
+ var context = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(calculationGroup,
+ new WaveImpactAsphaltCoverFailureMechanism(),
+ assessmentSection);
+
+ // Call
+ bool isEnabled = configurationExportInfo.IsEnabled(context);
+
+ // Assert
+ Assert.IsTrue(isEnabled);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test.csproj
===================================================================
diff -u -r6a5d7b40b7ba4dcb73e393075338352d194e97c2 -r7348fb685e44d6eb4abf2854c8298c0a2189d67e
--- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test.csproj (.../Ringtoets.WaveImpactAsphaltCover.Plugin.Test.csproj) (revision 6a5d7b40b7ba4dcb73e393075338352d194e97c2)
+++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test.csproj (.../Ringtoets.WaveImpactAsphaltCover.Plugin.Test.csproj) (revision 7348fb685e44d6eb4abf2854c8298c0a2189d67e)
@@ -63,6 +63,8 @@
Properties\GlobalAssembly.cs
+
+
@@ -136,6 +138,14 @@
{AF1ACFA2-AEE5-4DB7-98CA-8B3720E46AD9}Ringtoets.Revetment.Forms
+
+ {E3347B16-BB18-41C1-8D34-FBCBF20DB695}
+ Ringtoets.Revetment.IO
+
+
+ {3706200E-48C6-4B86-B48C-4E45C69ABE95}
+ Ringtoets.Revetment.Data.TestUtil
+ {567E0B69-5280-41CE-ADD6-443725A61C86}Ringtoets.WaveImpactAsphaltCover.Data
@@ -144,6 +154,10 @@
{1AC97B51-88C2-437D-89E6-65C69AB3CCAD}Ringtoets.WaveImpactAsphaltCover.Forms
+
+ {B388D2BA-FC6E-4EE2-B9B5-38D35F340FF5}
+ Ringtoets.WaveImpactAsphaltCover.IO
+ {83A782F1-BA78-4D5C-B213-39066605AFD8}Ringtoets.WaveImpactAsphaltCover.Plugin
Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/WaveImpactAsphaltCoverPluginTest.cs
===================================================================
diff -u -r0cc64a130e25bd1cb8ffa996799b2556c7798269 -r7348fb685e44d6eb4abf2854c8298c0a2189d67e
--- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/WaveImpactAsphaltCoverPluginTest.cs (.../WaveImpactAsphaltCoverPluginTest.cs) (revision 0cc64a130e25bd1cb8ffa996799b2556c7798269)
+++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/WaveImpactAsphaltCoverPluginTest.cs (.../WaveImpactAsphaltCoverPluginTest.cs) (revision 7348fb685e44d6eb4abf2854c8298c0a2189d67e)
@@ -132,8 +132,8 @@
ExportInfo[] exportInfos = plugin.GetExportInfos().ToArray();
// Assert
- Assert.AreEqual(2, exportInfos.Length);
- Assert.IsTrue(exportInfos.Any(ei => ei.DataType == typeof(WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext)));
+ Assert.AreEqual(3, exportInfos.Length);
+ Assert.AreEqual(2, exportInfos.Count(ei => ei.DataType == typeof(WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext)));
Assert.IsTrue(exportInfos.Any(ei => ei.DataType == typeof(WaveImpactAsphaltCoverWaveConditionsCalculationContext)));
}
}