Index: Riskeer/GrassCoverErosionOutwards/src/Riskeer.GrassCoverErosionOutwards.IO/Exporters/GrassCoverErosionOutwardsWaveConditionsExporter.cs =================================================================== diff -u -rd1ed7dab7b257ddeb6cec7168649edfd8d0fbe07 -rb8c0aa8812e84bd29f60d922802b3e101a8f8839 --- Riskeer/GrassCoverErosionOutwards/src/Riskeer.GrassCoverErosionOutwards.IO/Exporters/GrassCoverErosionOutwardsWaveConditionsExporter.cs (.../GrassCoverErosionOutwardsWaveConditionsExporter.cs) (revision d1ed7dab7b257ddeb6cec7168649edfd8d0fbe07) +++ Riskeer/GrassCoverErosionOutwards/src/Riskeer.GrassCoverErosionOutwards.IO/Exporters/GrassCoverErosionOutwardsWaveConditionsExporter.cs (.../GrassCoverErosionOutwardsWaveConditionsExporter.cs) (revision b8c0aa8812e84bd29f60d922802b3e101a8f8839) @@ -58,9 +58,23 @@ foreach (GrassCoverErosionOutwardsWaveConditionsCalculation calculation in exportableCalculations) { - exportableWaveConditions.AddRange( - ExportableWaveConditionsFactory.CreateExportableWaveConditionsCollection( - calculation.Name, calculation.InputParameters, calculation.Output.WaveRunUpOutput, CoverType.GrassWaveRunUp)); + GrassCoverErosionOutwardsWaveConditionsCalculationType calculationType = calculation.InputParameters.CalculationType; + + if (calculationType == GrassCoverErosionOutwardsWaveConditionsCalculationType.Both || + calculationType == GrassCoverErosionOutwardsWaveConditionsCalculationType.WaveRunUp) + { + exportableWaveConditions.AddRange( + ExportableWaveConditionsFactory.CreateExportableWaveConditionsCollection( + calculation.Name, calculation.InputParameters, calculation.Output.WaveRunUpOutput, CoverType.GrassWaveRunUp)); + } + + if (calculationType == GrassCoverErosionOutwardsWaveConditionsCalculationType.Both || + calculationType == GrassCoverErosionOutwardsWaveConditionsCalculationType.WaveImpact) + { + exportableWaveConditions.AddRange( + ExportableWaveConditionsFactory.CreateExportableWaveConditionsCollection( + calculation.Name, calculation.InputParameters, calculation.Output.WaveImpactOutput,CoverType.GrassWaveImpact)); + } } return exportableWaveConditions; Index: Riskeer/GrassCoverErosionOutwards/test/Riskeer.GrassCoverErosionOutwards.IO.Test/Exporters/GrassCoverErosionOutwardsWaveConditionsExporterTest.cs =================================================================== diff -u -re7f106928d957ff6a4c163a9d3ab4eee5fd466a4 -rb8c0aa8812e84bd29f60d922802b3e101a8f8839 --- Riskeer/GrassCoverErosionOutwards/test/Riskeer.GrassCoverErosionOutwards.IO.Test/Exporters/GrassCoverErosionOutwardsWaveConditionsExporterTest.cs (.../GrassCoverErosionOutwardsWaveConditionsExporterTest.cs) (revision e7f106928d957ff6a4c163a9d3ab4eee5fd466a4) +++ Riskeer/GrassCoverErosionOutwards/test/Riskeer.GrassCoverErosionOutwards.IO.Test/Exporters/GrassCoverErosionOutwardsWaveConditionsExporterTest.cs (.../GrassCoverErosionOutwardsWaveConditionsExporterTest.cs) (revision b8c0aa8812e84bd29f60d922802b3e101a8f8839) @@ -135,10 +135,10 @@ } [Test] - public void Export_ValidData_ValidFile() + public void Export_ValidDataWithCalculationTypeBoth_ValidFile() { // Setup - string folderName = $"{nameof(GrassCoverErosionOutwardsWaveConditionsExporterTest)}.{nameof(Export_ValidData_ValidFile)}"; + string folderName = $"{nameof(GrassCoverErosionOutwardsWaveConditionsExporterTest)}.{nameof(Export_ValidDataWithCalculationTypeBoth_ValidFile)}"; string directoryPath = TestHelper.GetScratchPadPath(folderName); using (new DirectoryDisposeHelper(TestHelper.GetScratchPadPath(), folderName)) { @@ -181,9 +181,116 @@ Assert.IsTrue(File.Exists(filePath)); string fileContent = File.ReadAllText(filePath); string expectedText = $"Naam berekening, Naam HB locatie, X HB locatie (RD) [m], Y HB locatie (RD) [m], Naam voorlandprofiel, Dam gebruikt, Voorlandgeometrie gebruikt, Type bekleding, Categoriegrens, Waterstand [m+NAP], Golfhoogte (Hs) [m], Golfperiode (Tp) [s], Golfrichting t.o.v. dijknormaal [°], Golfrichting t.o.v. Noord [°]{Environment.NewLine}" + + $"aCalculation, aLocation, 44.000, 123.456, foreshoreA, nee, nee, Gras (golfoploop), IVv, 1.10, 2.20, 3.30, 4.40, 5.50{Environment.NewLine}" + + $"aCalculation, aLocation, 44.000, 123.456, foreshoreA, nee, nee, Gras (golfklap), IVv, 1.10, 2.20, 3.30, 4.40, 5.50{Environment.NewLine}"; + Assert.AreEqual(expectedText, fileContent); + } + } + + [Test] + public void Export_ValidDataWithCalculationTypeWaveRunUp_ValidFile() + { + // Setup + string folderName = $"{nameof(GrassCoverErosionOutwardsWaveConditionsExporterTest)}.{nameof(Export_ValidDataWithCalculationTypeWaveRunUp_ValidFile)}"; + string directoryPath = TestHelper.GetScratchPadPath(folderName); + using (new DirectoryDisposeHelper(TestHelper.GetScratchPadPath(), folderName)) + { + string filePath = Path.Combine(directoryPath, "test.csv"); + + var calculations = new[] + { + new GrassCoverErosionOutwardsWaveConditionsCalculation + { + Name = "aCalculation", + InputParameters = + { + HydraulicBoundaryLocation = new HydraulicBoundaryLocation(8, "aLocation", 44, 123.456), + ForeshoreProfile = new TestForeshoreProfile("foreshoreA"), + LowerBoundaryRevetment = (RoundedDouble) 1.384, + UpperBoundaryRevetment = (RoundedDouble) 11.54898963, + StepSize = WaveConditionsInputStepSize.Half, + LowerBoundaryWaterLevels = (RoundedDouble) 1.98699, + UpperBoundaryWaterLevels = (RoundedDouble) 84.26548, + CategoryType = FailureMechanismCategoryType.LowerLimitNorm, + CalculationType = GrassCoverErosionOutwardsWaveConditionsCalculationType.WaveRunUp + }, + Output = GrassCoverErosionOutwardsWaveConditionsOutputTestFactory.Create( + new[] + { + new TestWaveConditionsOutput() + }, new[] + { + new TestWaveConditionsOutput() + }) + } + }; + + var exporter = new GrassCoverErosionOutwardsWaveConditionsExporter(calculations, filePath); + + // Call + bool isExported = exporter.Export(); + + // Assert + Assert.IsTrue(isExported); + Assert.IsTrue(File.Exists(filePath)); + string fileContent = File.ReadAllText(filePath); + string expectedText = $"Naam berekening, Naam HB locatie, X HB locatie (RD) [m], Y HB locatie (RD) [m], Naam voorlandprofiel, Dam gebruikt, Voorlandgeometrie gebruikt, Type bekleding, Categoriegrens, Waterstand [m+NAP], Golfhoogte (Hs) [m], Golfperiode (Tp) [s], Golfrichting t.o.v. dijknormaal [°], Golfrichting t.o.v. Noord [°]{Environment.NewLine}" + $"aCalculation, aLocation, 44.000, 123.456, foreshoreA, nee, nee, Gras (golfoploop), IVv, 1.10, 2.20, 3.30, 4.40, 5.50{Environment.NewLine}"; Assert.AreEqual(expectedText, fileContent); } } + + [Test] + public void Export_ValidDataWithCalculationTypeWaveImpact_ValidFile() + { + // Setup + string folderName = $"{nameof(GrassCoverErosionOutwardsWaveConditionsExporterTest)}.{nameof(Export_ValidDataWithCalculationTypeWaveImpact_ValidFile)}"; + string directoryPath = TestHelper.GetScratchPadPath(folderName); + using (new DirectoryDisposeHelper(TestHelper.GetScratchPadPath(), folderName)) + { + string filePath = Path.Combine(directoryPath, "test.csv"); + + var calculations = new[] + { + new GrassCoverErosionOutwardsWaveConditionsCalculation + { + Name = "aCalculation", + InputParameters = + { + HydraulicBoundaryLocation = new HydraulicBoundaryLocation(8, "aLocation", 44, 123.456), + ForeshoreProfile = new TestForeshoreProfile("foreshoreA"), + LowerBoundaryRevetment = (RoundedDouble) 1.384, + UpperBoundaryRevetment = (RoundedDouble) 11.54898963, + StepSize = WaveConditionsInputStepSize.Half, + LowerBoundaryWaterLevels = (RoundedDouble) 1.98699, + UpperBoundaryWaterLevels = (RoundedDouble) 84.26548, + CategoryType = FailureMechanismCategoryType.LowerLimitNorm, + CalculationType = GrassCoverErosionOutwardsWaveConditionsCalculationType.WaveImpact + }, + Output = GrassCoverErosionOutwardsWaveConditionsOutputTestFactory.Create( + new[] + { + new TestWaveConditionsOutput() + }, new[] + { + new TestWaveConditionsOutput() + }) + } + }; + + var exporter = new GrassCoverErosionOutwardsWaveConditionsExporter(calculations, filePath); + + // Call + bool isExported = exporter.Export(); + + // Assert + Assert.IsTrue(isExported); + Assert.IsTrue(File.Exists(filePath)); + string fileContent = File.ReadAllText(filePath); + string expectedText = $"Naam berekening, Naam HB locatie, X HB locatie (RD) [m], Y HB locatie (RD) [m], Naam voorlandprofiel, Dam gebruikt, Voorlandgeometrie gebruikt, Type bekleding, Categoriegrens, Waterstand [m+NAP], Golfhoogte (Hs) [m], Golfperiode (Tp) [s], Golfrichting t.o.v. dijknormaal [°], Golfrichting t.o.v. Noord [°]{Environment.NewLine}" + + $"aCalculation, aLocation, 44.000, 123.456, foreshoreA, nee, nee, Gras (golfklap), IVv, 1.10, 2.20, 3.30, 4.40, 5.50{Environment.NewLine}"; + Assert.AreEqual(expectedText, fileContent); + } + } } } \ No newline at end of file Index: Riskeer/StabilityStoneCover/test/Riskeer.StabilityStoneCover.IO.Test/Exporters/StabilityStoneCoverWaveConditionsExporterTest.cs =================================================================== diff -u -rc32c226a5d288217f86cf255f76839d4f46b2032 -rb8c0aa8812e84bd29f60d922802b3e101a8f8839 --- Riskeer/StabilityStoneCover/test/Riskeer.StabilityStoneCover.IO.Test/Exporters/StabilityStoneCoverWaveConditionsExporterTest.cs (.../StabilityStoneCoverWaveConditionsExporterTest.cs) (revision c32c226a5d288217f86cf255f76839d4f46b2032) +++ Riskeer/StabilityStoneCover/test/Riskeer.StabilityStoneCover.IO.Test/Exporters/StabilityStoneCoverWaveConditionsExporterTest.cs (.../StabilityStoneCoverWaveConditionsExporterTest.cs) (revision b8c0aa8812e84bd29f60d922802b3e101a8f8839) @@ -128,10 +128,10 @@ } [Test] - public void Export_ValidDataWithColumnsAndBlocksOutput_ValidFile() + public void Export_ValidDataWithCalculationTypeBoth_ValidFile() { // Setup - string folderName = $"{nameof(StabilityStoneCoverWaveConditionsExporterTest)}.{nameof(Export_ValidDataWithColumnsAndBlocksOutput_ValidFile)}"; + string folderName = $"{nameof(StabilityStoneCoverWaveConditionsExporterTest)}.{nameof(Export_ValidDataWithCalculationTypeBoth_ValidFile)}"; string directoryPath = TestHelper.GetScratchPadPath(folderName); using (new DirectoryDisposeHelper(TestHelper.GetScratchPadPath(), folderName)) { @@ -181,10 +181,10 @@ } [Test] - public void Export_ValidDataWithColumnsOutput_ValidFile() + public void Export_ValidDataWithCalculationTypeColumns_ValidFile() { // Setup - string folderName = $"{nameof(StabilityStoneCoverWaveConditionsExporterTest)}.{nameof(Export_ValidDataWithColumnsOutput_ValidFile)}"; + string folderName = $"{nameof(StabilityStoneCoverWaveConditionsExporterTest)}.{nameof(Export_ValidDataWithCalculationTypeColumns_ValidFile)}"; string directoryPath = TestHelper.GetScratchPadPath(folderName); using (new DirectoryDisposeHelper(TestHelper.GetScratchPadPath(), folderName)) { @@ -233,10 +233,10 @@ } [Test] - public void Export_ValidDataWithBlocksOutput_ValidFile() + public void Export_ValidDataWithCalculationTypeBlocks_ValidFile() { // Setup - string folderName = $"{nameof(StabilityStoneCoverWaveConditionsExporterTest)}.{nameof(Export_ValidDataWithBlocksOutput_ValidFile)}"; + string folderName = $"{nameof(StabilityStoneCoverWaveConditionsExporterTest)}.{nameof(Export_ValidDataWithCalculationTypeBlocks_ValidFile)}"; string directoryPath = TestHelper.GetScratchPadPath(folderName); using (new DirectoryDisposeHelper(TestHelper.GetScratchPadPath(), folderName)) {