Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -rc31353107227995d74e8727a85b02a89a39c139d -rd04efd93e668625dd987f6987e8273fc613a2f21 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision c31353107227995d74e8727a85b02a89a39c139d) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision d04efd93e668625dd987f6987e8273fc613a2f21) @@ -692,6 +692,15 @@ } /// + /// Looks up a localized string similar to Ringtoets berekeningenconfiguratie (*.xml). + /// + public static string ConfigurationExporter_DisplayName { + get { + return ResourceManager.GetString("ConfigurationExporter_DisplayName", resourceCulture); + } + } + + /// /// Looks up a localized string similar to De bijdrage van dit toetsspoor is nul.. /// public static string Contribution_of_failure_mechanism_zero { Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx =================================================================== diff -u -rc31353107227995d74e8727a85b02a89a39c139d -rd04efd93e668625dd987f6987e8273fc613a2f21 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision c31353107227995d74e8727a85b02a89a39c139d) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision d04efd93e668625dd987f6987e8273fc613a2f21) @@ -932,4 +932,7 @@ Ringtoets berekeningenconfiguratie + + Ringtoets berekeningenconfiguratie (*.xml) + \ No newline at end of file Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs =================================================================== diff -u -rc31353107227995d74e8727a85b02a89a39c139d -rd04efd93e668625dd987f6987e8273fc613a2f21 --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs (.../GrassCoverErosionOutwardsPlugin.cs) (revision c31353107227995d74e8727a85b02a89a39c139d) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs (.../GrassCoverErosionOutwardsPlugin.cs) (revision d04efd93e668625dd987f6987e8273fc613a2f21) @@ -272,7 +272,7 @@ yield return new ExportInfo { - Name = "Golfcondities (*.csv).", + Name = RingtoetsCommonFormsResources.WaveConditionsExporter_DisplayName, CreateFileExporter = (context, filePath) => { var calculations = context.WrappedData.GetCalculations().Cast(); @@ -285,7 +285,7 @@ yield return new ExportInfo { - Name = "Configuratie van de berekeningen (*.xml).", + Name = RingtoetsCommonFormsResources.ConfigurationExporter_DisplayName, CreateFileExporter = (context, filePath) => new GrassCoverErosionOutwardsConfigurationExporter(context.WrappedData, filePath), IsEnabled = context => context.WrappedData.Children.Any(), FileFilterGenerator = new FileFilterGenerator(RingtoetsCommonFormsResources.DataTypeDisplayName_xml_file_filter_Extension, Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/ExportInfos/GrassCoverErosionOutwardsWaveConditionsCalculationGroupContextExportInfoTest.cs =================================================================== diff -u -rc31353107227995d74e8727a85b02a89a39c139d -rd04efd93e668625dd987f6987e8273fc613a2f21 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/ExportInfos/GrassCoverErosionOutwardsWaveConditionsCalculationGroupContextExportInfoTest.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculationGroupContextExportInfoTest.cs) (revision c31353107227995d74e8727a85b02a89a39c139d) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/ExportInfos/GrassCoverErosionOutwardsWaveConditionsCalculationGroupContextExportInfoTest.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculationGroupContextExportInfoTest.cs) (revision d04efd93e668625dd987f6987e8273fc613a2f21) @@ -48,8 +48,8 @@ using (var plugin = new GrassCoverErosionOutwardsPlugin()) { ExportInfo[] exportInfos = plugin.GetExportInfos().Where(ei => ei.DataType == typeof(GrassCoverErosionOutwardsWaveConditionsCalculationGroupContext)).ToArray(); - waveConditionsExportInfo = exportInfos.Single(ei => ei.Name.Equals("Golfcondities (*.csv).")); - configurationExportInfo = exportInfos.Single(ei => ei.Name.Equals("Configuratie van de berekeningen (*.xml).")); + waveConditionsExportInfo = exportInfos.Single(ei => ei.Name.Equals("Berekende belastingen bij verschillende waterstanden (*.csv).")); + configurationExportInfo = exportInfos.Single(ei => ei.Name.Equals("Ringtoets berekeningenconfiguratie (*.xml)")); } } @@ -59,7 +59,7 @@ // Assert Assert.IsNotNull(waveConditionsExportInfo.CreateFileExporter); Assert.IsNotNull(waveConditionsExportInfo.IsEnabled); - Assert.AreEqual("Golfcondities (*.csv).", waveConditionsExportInfo.Name); + Assert.AreEqual("Berekende belastingen bij verschillende waterstanden (*.csv).", waveConditionsExportInfo.Name); Assert.IsNull(waveConditionsExportInfo.Category); Assert.IsNull(waveConditionsExportInfo.Image); Assert.IsNotNull(waveConditionsExportInfo.FileFilterGenerator); @@ -204,7 +204,7 @@ // Assert Assert.IsNotNull(configurationExportInfo.CreateFileExporter); Assert.IsNotNull(configurationExportInfo.IsEnabled); - Assert.AreEqual("Configuratie van de berekeningen (*.xml).", configurationExportInfo.Name); + Assert.AreEqual("Ringtoets berekeningenconfiguratie (*.xml)", configurationExportInfo.Name); Assert.IsNull(configurationExportInfo.Category); Assert.IsNull(configurationExportInfo.Image); Assert.IsNotNull(configurationExportInfo.FileFilterGenerator); Fisheye: Tag d04efd93e668625dd987f6987e8273fc613a2f21 refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ExportInfos/StabilityStoneCoverWaveConditionsCalculationContextExportInfoTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag d04efd93e668625dd987f6987e8273fc613a2f21 refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ExportInfos/StabilityStoneCoverWaveConditionsCalculationGroupContextExportInfoTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj =================================================================== diff -u -ra7afd20c799a137bf3d1bf8fd2942bde36e482c4 -rd04efd93e668625dd987f6987e8273fc613a2f21 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision a7afd20c799a137bf3d1bf8fd2942bde36e482c4) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision d04efd93e668625dd987f6987e8273fc613a2f21) @@ -75,8 +75,6 @@ - - @@ -288,14 +286,6 @@ {8E4E1877-697A-45D3-81CF-169EFDF65AA0} Ringtoets.StabilityStoneCover.Forms - - {CF6B8598-2993-4A8E-801D-121CC0EF358E} - Ringtoets.StabilityStoneCover.IO - - - {9DDC42CC-A2CC-4900-A711-AA1DD6D3A94A} - Ringtoets.StabilityStoneCover.Plugin - {567e0b69-5280-41ce-add6-443725a61c86} Ringtoets.WaveImpactAsphaltCover.Data Index: Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Plugin/StabilityStoneCoverPlugin.cs =================================================================== diff -u -ra7afd20c799a137bf3d1bf8fd2942bde36e482c4 -rd04efd93e668625dd987f6987e8273fc613a2f21 --- Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Plugin/StabilityStoneCoverPlugin.cs (.../StabilityStoneCoverPlugin.cs) (revision a7afd20c799a137bf3d1bf8fd2942bde36e482c4) +++ Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Plugin/StabilityStoneCoverPlugin.cs (.../StabilityStoneCoverPlugin.cs) (revision d04efd93e668625dd987f6987e8273fc613a2f21) @@ -155,7 +155,7 @@ { yield return new ExportInfo { - Name = "Golfcondities (*.csv).", + Name = RingtoetsCommonFormsResources.WaveConditionsExporter_DisplayName, CreateFileExporter = (context, filePath) => new StabilityStoneCoverWaveConditionsExporter(context.WrappedData.GetCalculations().Cast(), filePath), IsEnabled = context => context.WrappedData.GetCalculations().Cast().Any(c => c.HasOutput), FileFilterGenerator = new FileFilterGenerator( @@ -165,7 +165,7 @@ yield return new ExportInfo { - Name = "Configuratie van de berekeningen (*.xml).", + Name = RingtoetsCommonFormsResources.ConfigurationExporter_DisplayName, CreateFileExporter = (context, filePath) => new StabilityStoneCoverConfigurationExporter(context.WrappedData, filePath), IsEnabled = context => context.WrappedData.Children.Any(), FileFilterGenerator = new FileFilterGenerator( Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/ExportInfos/StabilityStoneCoverWaveConditionsCalculationContextExportInfoTest.cs =================================================================== diff -u --- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/ExportInfos/StabilityStoneCoverWaveConditionsCalculationContextExportInfoTest.cs (revision 0) +++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/ExportInfos/StabilityStoneCoverWaveConditionsCalculationContextExportInfoTest.cs (revision d04efd93e668625dd987f6987e8273fc613a2f21) @@ -0,0 +1,171 @@ +// 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.StabilityStoneCover.Data; +using Ringtoets.StabilityStoneCover.Forms.PresentationObjects; + +namespace Ringtoets.StabilityStoneCover.Plugin.Test.ExportInfos +{ + [TestFixture] + public class StabilityStoneCoverWaveConditionsCalculationContextExportInfoTest + { + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Setup + using (var plugin = new StabilityStoneCoverPlugin()) + { + // 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 StabilityStoneCoverFailureMechanism(); + + var context = new StabilityStoneCoverWaveConditionsCalculationContext(new StabilityStoneCoverWaveConditionsCalculation(), + failureMechanism, assessmentSection); + using (var plugin = new StabilityStoneCoverPlugin()) + { + 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 StabilityStoneCoverPlugin()) + { + ExportInfo exportInfo = GetExportInfo(plugin); + + // Call + FileFilterGenerator fileFilterGenerator = exportInfo.FileFilterGenerator; + + // Assert + Assert.AreEqual("Kommagescheiden bestand (*.csv)|*.csv", fileFilterGenerator.Filter); + } + } + + [Test] + public void IsEnabled_StabilityStoneCoverWaveConditionsCalculationHasOutputFalse_ReturnsFalse() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + var failureMechanism = new StabilityStoneCoverFailureMechanism(); + + var context = new StabilityStoneCoverWaveConditionsCalculationContext(new StabilityStoneCoverWaveConditionsCalculation(), + failureMechanism, assessmentSection); + using (var plugin = new StabilityStoneCoverPlugin()) + { + ExportInfo exportInfo = GetExportInfo(plugin); + + // Call + bool isEnabled = exportInfo.IsEnabled(context); + + // Assert + Assert.IsFalse(isEnabled); + } + + mocks.VerifyAll(); + } + + [Test] + public void IsEnabled_StabilityStoneCoverWaveConditionsCalculationHasOutputTrue_ReturnsTrue() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + var failureMechanism = new StabilityStoneCoverFailureMechanism(); + var columnsOutput = new[] + { + new TestWaveConditionsOutput() + }; + + var blocksOutput = new[] + { + new TestWaveConditionsOutput() + }; + + var context = new StabilityStoneCoverWaveConditionsCalculationContext( + new StabilityStoneCoverWaveConditionsCalculation + { + Output = new StabilityStoneCoverWaveConditionsOutput(columnsOutput, blocksOutput) + }, + failureMechanism, assessmentSection); + + using (var plugin = new StabilityStoneCoverPlugin()) + { + ExportInfo exportInfo = GetExportInfo(plugin); + + // Call + bool isEnabled = exportInfo.IsEnabled(context); + + // Assert + Assert.IsTrue(isEnabled); + } + + mocks.VerifyAll(); + } + + private static ExportInfo GetExportInfo(StabilityStoneCoverPlugin plugin) + { + return plugin.GetExportInfos().First(ei => ei.DataType == typeof(StabilityStoneCoverWaveConditionsCalculationContext)); + } + } +} \ No newline at end of file Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/ExportInfos/StabilityStoneCoverWaveConditionsCalculationGroupContextExportInfoTest.cs =================================================================== diff -u --- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/ExportInfos/StabilityStoneCoverWaveConditionsCalculationGroupContextExportInfoTest.cs (revision 0) +++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/ExportInfos/StabilityStoneCoverWaveConditionsCalculationGroupContextExportInfoTest.cs (revision d04efd93e668625dd987f6987e8273fc613a2f21) @@ -0,0 +1,325 @@ +// 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.StabilityStoneCover.Data; +using Ringtoets.StabilityStoneCover.Forms.PresentationObjects; +using Ringtoets.StabilityStoneCover.IO; + +namespace Ringtoets.StabilityStoneCover.Plugin.Test.ExportInfos +{ + [TestFixture] + public class StabilityStoneCoverWaveConditionsCalculationGroupContextExportInfoTest + { + private ExportInfo waveConditionsExportInfo; + private ExportInfo configurationExportInfo; + + [SetUp] + public void Setup() + { + using (var plugin = new StabilityStoneCoverPlugin()) + { + ExportInfo[] exportInfos = plugin.GetExportInfos().Where(ei => ei.DataType == typeof(StabilityStoneCoverWaveConditionsCalculationGroupContext)).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 StabilityStoneCoverFailureMechanism(); + var calculationGroup = new CalculationGroup(); + + var context = new StabilityStoneCoverWaveConditionsCalculationGroupContext(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_NoStabilityStoneCoverWaveConditionsCalculation_IsEnabledFalse() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + var failureMechanism = new StabilityStoneCoverFailureMechanism(); + var calculationGroup = new CalculationGroup(); + + var context = new StabilityStoneCoverWaveConditionsCalculationGroupContext(calculationGroup, failureMechanism, assessmentSection); + + // Call + bool isEnabled = waveConditionsExportInfo.IsEnabled(context); + + // Assert + Assert.IsFalse(isEnabled); + + mocks.VerifyAll(); + } + + [Test] + public void WaveConditionsExportInfo_StabilityStoneCoverWaveConditionsCalculationHasOutputFalse_IsEnabledFalse() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + var failureMechanism = new StabilityStoneCoverFailureMechanism(); + var calculationGroup = new CalculationGroup(); + calculationGroup.Children.Add(new StabilityStoneCoverWaveConditionsCalculation()); + + var context = new StabilityStoneCoverWaveConditionsCalculationGroupContext(calculationGroup, failureMechanism, assessmentSection); + + // Call + bool isEnabled = waveConditionsExportInfo.IsEnabled(context); + + // Assert + Assert.IsFalse(isEnabled); + + mocks.VerifyAll(); + } + + [Test] + public void WaveConditionsExportInfo_StabilityStoneCoverWaveConditionsCalculationHasOutputTrue_IsEnabledTrue() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + var failureMechanism = new StabilityStoneCoverFailureMechanism(); + var calculationGroup = new CalculationGroup(); + var columnsOutput = new[] + { + new TestWaveConditionsOutput() + }; + + var blocksOutput = new[] + { + new TestWaveConditionsOutput() + }; + calculationGroup.Children.Add(new StabilityStoneCoverWaveConditionsCalculation + { + Output = new StabilityStoneCoverWaveConditionsOutput(columnsOutput, blocksOutput) + }); + + var context = new StabilityStoneCoverWaveConditionsCalculationGroupContext(calculationGroup, failureMechanism, assessmentSection); + + // Call + bool isEnabled = waveConditionsExportInfo.IsEnabled(context); + + // Assert + Assert.IsTrue(isEnabled); + + mocks.VerifyAll(); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void WaveConditionsExportInfo_StabilityStoneCoverWaveConditionsCalculationInSubFolder_IsEnabledTrueIfHasOutput(bool hasOutput) + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + var failureMechanism = new StabilityStoneCoverFailureMechanism(); + var calculationGroup = new CalculationGroup(); + + StabilityStoneCoverWaveConditionsOutput stabilityStoneCoverWaveConditionsOutput = null; + if (hasOutput) + { + var columnsOutput = new[] + { + new TestWaveConditionsOutput() + }; + + var blocksOutput = new[] + { + new TestWaveConditionsOutput() + }; + + stabilityStoneCoverWaveConditionsOutput = new StabilityStoneCoverWaveConditionsOutput(columnsOutput, blocksOutput); + } + calculationGroup.Children.Add( + new CalculationGroup + { + Children = + { + new StabilityStoneCoverWaveConditionsCalculation + { + Output = stabilityStoneCoverWaveConditionsOutput + } + } + }); + + var context = new StabilityStoneCoverWaveConditionsCalculationGroupContext(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 StabilityStoneCoverWaveConditionsCalculationGroupContext(new CalculationGroup(), + new StabilityStoneCoverFailureMechanism(), + 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 StabilityStoneCoverWaveConditionsCalculationGroupContext(new CalculationGroup(), + new StabilityStoneCoverFailureMechanism(), + assessmentSection); + + // Call + bool isEnabled = configurationExportInfo.IsEnabled(context); + + // Assert + Assert.IsFalse(isEnabled); + + mocks.VerifyAll(); + } + + [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 StabilityStoneCoverWaveConditionsCalculation()); + } + + var context = new StabilityStoneCoverWaveConditionsCalculationGroupContext(calculationGroup, + new StabilityStoneCoverFailureMechanism(), + assessmentSection); + + // Call + bool isEnabled = configurationExportInfo.IsEnabled(context); + + // Assert + Assert.IsTrue(isEnabled); + } + } +} \ No newline at end of file Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/Ringtoets.StabilityStoneCover.Plugin.Test.csproj =================================================================== diff -u -r6a5d7b40b7ba4dcb73e393075338352d194e97c2 -rd04efd93e668625dd987f6987e8273fc613a2f21 --- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/Ringtoets.StabilityStoneCover.Plugin.Test.csproj (.../Ringtoets.StabilityStoneCover.Plugin.Test.csproj) (revision 6a5d7b40b7ba4dcb73e393075338352d194e97c2) +++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/Ringtoets.StabilityStoneCover.Plugin.Test.csproj (.../Ringtoets.StabilityStoneCover.Plugin.Test.csproj) (revision d04efd93e668625dd987f6987e8273fc613a2f21) @@ -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 + {b479e3af-7c34-488c-bb73-d324100d36c9} Ringtoets.StabilityStoneCover.Data @@ -144,6 +154,10 @@ {8e4e1877-697a-45d3-81cf-169efdf65aa0} Ringtoets.StabilityStoneCover.Forms + + {CF6B8598-2993-4A8E-801D-121CC0EF358E} + Ringtoets.StabilityStoneCover.IO + {9ddc42cc-a2cc-4900-a711-aa1dd6d3a94a} Ringtoets.StabilityStoneCover.Plugin