Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/ExportInfos/WaveImpactAsphaltCoverWaveConditionsCalculationContextConfigurationExportInfoTest.cs =================================================================== diff -u --- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/ExportInfos/WaveImpactAsphaltCoverWaveConditionsCalculationContextConfigurationExportInfoTest.cs (revision 0) +++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/ExportInfos/WaveImpactAsphaltCoverWaveConditionsCalculationContextConfigurationExportInfoTest.cs (revision 68e42f759b0e3ca925c9ef38fb5ce905f9cc6ba8) @@ -0,0 +1,116 @@ +// 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.WaveImpactAsphaltCover.Data; +using Ringtoets.WaveImpactAsphaltCover.Forms.PresentationObjects; +using Ringtoets.WaveImpactAsphaltCover.IO.Exporters; + +namespace Ringtoets.WaveImpactAsphaltCover.Plugin.Test.ExportInfos +{ + [TestFixture] + public class WaveImpactAsphaltCoverWaveConditionsCalculationContextConfigurationExportInfoTest + { + private ExportInfo exportInfo; + + [SetUp] + public void Setup() + { + using (var plugin = new WaveImpactAsphaltCoverPlugin()) + { + exportInfo = plugin.GetExportInfos() + .Single(ei => ei.DataType == typeof(WaveImpactAsphaltCoverWaveConditionsCalculationContext) + && ei.Name.Equals("Ringtoets berekeningenconfiguratie (*.xml)")); + } + } + + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Assert + Assert.IsNotNull(exportInfo.CreateFileExporter); + Assert.IsNotNull(exportInfo.IsEnabled); + Assert.IsNull(exportInfo.Category); + Assert.IsNull(exportInfo.Image); + Assert.IsNotNull(exportInfo.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); + + // Call + IFileExporter fileExporter = exportInfo.CreateFileExporter(context, "test"); + + // Assert + Assert.IsInstanceOf(fileExporter); + mocks.VerifyAll(); + } + + [Test] + public void FileFilterGenerator_Always_ReturnFileFilter() + { + // Call + FileFilterGenerator fileFilterGenerator = exportInfo.FileFilterGenerator; + + // Assert + Assert.AreEqual("Ringtoets berekeningenconfiguratie (*.xml)|*.xml", fileFilterGenerator.Filter); + } + + [Test] + public void IsEnabled_Always_ReturnTrue() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism(); + + var context = new WaveImpactAsphaltCoverWaveConditionsCalculationContext( + new WaveImpactAsphaltCoverWaveConditionsCalculation(), + failureMechanism, + assessmentSection); + + // Call + bool isEnabled = exportInfo.IsEnabled(context); + + // Assert + Assert.IsTrue(isEnabled); + mocks.VerifyAll(); + } + } +} \ No newline at end of file Fisheye: Tag 68e42f759b0e3ca925c9ef38fb5ce905f9cc6ba8 refers to a dead (removed) revision in file `Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/ExportInfos/WaveImpactAsphaltCoverWaveConditionsCalculationContextExportInfoTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/ExportInfos/WaveImpactAsphaltCoverWaveConditionsCalculationContextWaveConditionsExportInfoTest.cs =================================================================== diff -u --- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/ExportInfos/WaveImpactAsphaltCoverWaveConditionsCalculationContextWaveConditionsExportInfoTest.cs (revision 0) +++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/ExportInfos/WaveImpactAsphaltCoverWaveConditionsCalculationContextWaveConditionsExportInfoTest.cs (revision 68e42f759b0e3ca925c9ef38fb5ce905f9cc6ba8) @@ -0,0 +1,116 @@ +// 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.WaveImpactAsphaltCover.Data; +using Ringtoets.WaveImpactAsphaltCover.Forms.PresentationObjects; +using Ringtoets.WaveImpactAsphaltCover.IO.Exporters; + +namespace Ringtoets.WaveImpactAsphaltCover.Plugin.Test.ExportInfos +{ + [TestFixture] + public class WaveImpactAsphaltCoverWaveConditionsCalculationContextWaveConditionsExportInfoTest + { + private ExportInfo exportInfo; + + [SetUp] + public void Setup() + { + using (var plugin = new WaveImpactAsphaltCoverPlugin()) + { + exportInfo = plugin.GetExportInfos() + .Single(ei => ei.DataType == typeof(WaveImpactAsphaltCoverWaveConditionsCalculationContext) + && ei.Name.Equals("Ringtoets berekeningenconfiguratie (*.xml)")); + } + } + + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Assert + Assert.IsNotNull(exportInfo.CreateFileExporter); + Assert.IsNotNull(exportInfo.IsEnabled); + Assert.IsNull(exportInfo.Category); + Assert.IsNull(exportInfo.Image); + Assert.IsNotNull(exportInfo.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); + + // Call + IFileExporter fileExporter = exportInfo.CreateFileExporter(context, "test"); + + // Assert + Assert.IsInstanceOf(fileExporter); + mocks.VerifyAll(); + } + + [Test] + public void FileFilterGenerator_Always_ReturnFileFilter() + { + // Call + FileFilterGenerator fileFilterGenerator = exportInfo.FileFilterGenerator; + + // Assert + Assert.AreEqual("Ringtoets berekeningenconfiguratie (*.xml)|*.xml", fileFilterGenerator.Filter); + } + + [Test] + public void IsEnabled_Always_ReturnTrue() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism(); + + var context = new WaveImpactAsphaltCoverWaveConditionsCalculationContext( + new WaveImpactAsphaltCoverWaveConditionsCalculation(), + failureMechanism, + assessmentSection); + + // Call + bool isEnabled = exportInfo.IsEnabled(context); + + // Assert + Assert.IsTrue(isEnabled); + mocks.VerifyAll(); + } + } +} \ No newline at end of file Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/ExportInfos/WaveImpactAsphaltCoverWaveConditionsCalculationGroupContextConfigurationExportInfoTest.cs =================================================================== diff -u --- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/ExportInfos/WaveImpactAsphaltCoverWaveConditionsCalculationGroupContextConfigurationExportInfoTest.cs (revision 0) +++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/ExportInfos/WaveImpactAsphaltCoverWaveConditionsCalculationGroupContextConfigurationExportInfoTest.cs (revision 68e42f759b0e3ca925c9ef38fb5ce905f9cc6ba8) @@ -0,0 +1,144 @@ +// 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.WaveImpactAsphaltCover.Data; +using Ringtoets.WaveImpactAsphaltCover.Forms.PresentationObjects; +using Ringtoets.WaveImpactAsphaltCover.IO.Exporters; + +namespace Ringtoets.WaveImpactAsphaltCover.Plugin.Test.ExportInfos +{ + [TestFixture] + public class WaveImpactAsphaltCoverWaveConditionsCalculationGroupContextConfigurationExportInfoTest + { + private ExportInfo exportInfo; + + [SetUp] + public void Setup() + { + using (var plugin = new WaveImpactAsphaltCoverPlugin()) + { + exportInfo = plugin.GetExportInfos() + .Single(ei => ei.DataType == typeof(WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext) + && ei.Name.Equals("Ringtoets berekeningenconfiguratie (*.xml)")); + } + } + + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Assert + Assert.IsNotNull(exportInfo.CreateFileExporter); + Assert.IsNotNull(exportInfo.IsEnabled); + Assert.IsNull(exportInfo.Category); + Assert.IsNull(exportInfo.Image); + Assert.IsNotNull(exportInfo.FileFilterGenerator); + } + + [Test] + public void CreateFileExporter_Always_ReturnFileExporter() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + var context = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(new CalculationGroup(), + new WaveImpactAsphaltCoverFailureMechanism(), + assessmentSection); + + // Call + IFileExporter fileExporter = exportInfo.CreateFileExporter(context, "test"); + + // Assert + Assert.IsInstanceOf(fileExporter); + } + + [Test] + public void FileFilterGenerator_Always_ReturnFileFilter() + { + // Call + FileFilterGenerator fileFilterGenerator = exportInfo.FileFilterGenerator; + + // Assert + Assert.AreEqual("Ringtoets berekeningenconfiguratie (*.xml)|*.xml", fileFilterGenerator.Filter); + } + + [Test] + public void IsEnabled_CalculationGroupNoChildren_ReturnFalse() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + var context = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(new CalculationGroup(), + new WaveImpactAsphaltCoverFailureMechanism(), + assessmentSection); + + // Call + bool isEnabled = exportInfo.IsEnabled(context); + + // Assert + Assert.IsFalse(isEnabled); + } + + [Test] + [TestCase(true, false)] + [TestCase(false, true)] + public void IsEnabled_CalculationGroupWithChildren_ReturnTrue(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 = exportInfo.IsEnabled(context); + + // Assert + Assert.IsTrue(isEnabled); + } + } +} \ No newline at end of file Fisheye: Tag 68e42f759b0e3ca925c9ef38fb5ce905f9cc6ba8 refers to a dead (removed) revision in file `Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/ExportInfos/WaveImpactAsphaltCoverWaveConditionsCalculationGroupContextExportInfoTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/ExportInfos/WaveImpactAsphaltCoverWaveConditionsCalculationGroupContextWaveConditionsExportInfoTest.cs =================================================================== diff -u --- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/ExportInfos/WaveImpactAsphaltCoverWaveConditionsCalculationGroupContextWaveConditionsExportInfoTest.cs (revision 0) +++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/ExportInfos/WaveImpactAsphaltCoverWaveConditionsCalculationGroupContextWaveConditionsExportInfoTest.cs (revision 68e42f759b0e3ca925c9ef38fb5ce905f9cc6ba8) @@ -0,0 +1,197 @@ +// 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.Exporters; +using Ringtoets.Revetment.TestUtil; +using Ringtoets.WaveImpactAsphaltCover.Data; +using Ringtoets.WaveImpactAsphaltCover.Forms.PresentationObjects; + +namespace Ringtoets.WaveImpactAsphaltCover.Plugin.Test.ExportInfos +{ + [TestFixture] + public class WaveImpactAsphaltCoverWaveConditionsCalculationGroupContextWaveConditionsExportInfoTest + { + private ExportInfo exportInfo; + + [SetUp] + public void Setup() + { + using (var plugin = new WaveImpactAsphaltCoverPlugin()) + { + exportInfo = plugin.GetExportInfos() + .Single(ei => ei.DataType == typeof(WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext) + && ei.Name.Equals("Berekende belastingen bij verschillende waterstanden (*.csv).")); + } + } + + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Assert + Assert.IsNotNull(exportInfo.CreateFileExporter); + Assert.IsNotNull(exportInfo.IsEnabled); + Assert.IsNull(exportInfo.Category); + Assert.IsNull(exportInfo.Image); + Assert.IsNotNull(exportInfo.FileFilterGenerator); + } + + [Test] + public void CreateFileExporter_Always_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 = exportInfo.CreateFileExporter(context, "test"); + + // Assert + Assert.IsInstanceOf(fileExporter); + + mocks.VerifyAll(); + } + + [Test] + public void FileFilterGenerator_Always_ReturnFileFilter() + { + // Call + FileFilterGenerator fileFilterGenerator = exportInfo.FileFilterGenerator; + + // Assert + Assert.AreEqual("Kommagescheiden bestand (*.csv)|*.csv", fileFilterGenerator.Filter); + } + + [Test] + public void IsEnabled_NoWaveImpactAsphaltCoverWaveConditionsCalculation_ReturnFalse() + { + // 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 = exportInfo.IsEnabled(context); + + // Assert + Assert.IsFalse(isEnabled); + mocks.VerifyAll(); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void IsEnabled_CalculationWithOrWithoutOutput_ReturnExpectedEnabledState(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 = exportInfo.IsEnabled(context); + + // Assert + Assert.AreEqual(hasOutput, isEnabled); + mocks.VerifyAll(); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void IsEnabled_CalculationInSubFolder_ReturnExpectedEnabledState(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 = exportInfo.IsEnabled(context); + + // Assert + Assert.AreEqual(hasOutput, isEnabled); + mocks.VerifyAll(); + } + } +} \ No newline at end of file Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test.csproj =================================================================== diff -u -r7348fb685e44d6eb4abf2854c8298c0a2189d67e -r68e42f759b0e3ca925c9ef38fb5ce905f9cc6ba8 --- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test.csproj (.../Ringtoets.WaveImpactAsphaltCover.Plugin.Test.csproj) (revision 7348fb685e44d6eb4abf2854c8298c0a2189d67e) +++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test/Ringtoets.WaveImpactAsphaltCover.Plugin.Test.csproj (.../Ringtoets.WaveImpactAsphaltCover.Plugin.Test.csproj) (revision 68e42f759b0e3ca925c9ef38fb5ce905f9cc6ba8) @@ -63,8 +63,10 @@ Properties\GlobalAssembly.cs - - + + + +