Index: Riskeer/GrassCoverErosionOutwards/src/Riskeer.GrassCoverErosionOutwards.IO/Exporters/GrassCoverErosionOutwardsWaveConditionsExporter.cs =================================================================== diff -u -r9dc2ef789dc92eb94557abffedd2609613a41728 -r00400ebd34caa40eeb3b9ccbf134628377e99225 --- Riskeer/GrassCoverErosionOutwards/src/Riskeer.GrassCoverErosionOutwards.IO/Exporters/GrassCoverErosionOutwardsWaveConditionsExporter.cs (.../GrassCoverErosionOutwardsWaveConditionsExporter.cs) (revision 9dc2ef789dc92eb94557abffedd2609613a41728) +++ Riskeer/GrassCoverErosionOutwards/src/Riskeer.GrassCoverErosionOutwards.IO/Exporters/GrassCoverErosionOutwardsWaveConditionsExporter.cs (.../GrassCoverErosionOutwardsWaveConditionsExporter.cs) (revision 00400ebd34caa40eeb3b9ccbf134628377e99225) @@ -61,20 +61,32 @@ GrassCoverErosionOutwardsWaveConditionsCalculationType calculationType = calculation.InputParameters.CalculationType; if (calculationType == GrassCoverErosionOutwardsWaveConditionsCalculationType.WaveRunUpAndWaveImpact || - calculationType == GrassCoverErosionOutwardsWaveConditionsCalculationType.WaveRunUp) + calculationType == GrassCoverErosionOutwardsWaveConditionsCalculationType.WaveRunUp || + calculationType == GrassCoverErosionOutwardsWaveConditionsCalculationType.WaveRunUpAndTailorMadeWaveImpact || + calculationType == GrassCoverErosionOutwardsWaveConditionsCalculationType.All) { exportableWaveConditions.AddRange( ExportableWaveConditionsFactory.CreateExportableWaveConditionsCollection( calculation.Name, calculation.InputParameters, calculation.Output.WaveRunUpOutput, CoverType.GrassWaveRunUp)); } if (calculationType == GrassCoverErosionOutwardsWaveConditionsCalculationType.WaveRunUpAndWaveImpact || - calculationType == GrassCoverErosionOutwardsWaveConditionsCalculationType.WaveImpact) + calculationType == GrassCoverErosionOutwardsWaveConditionsCalculationType.WaveImpact || + calculationType == GrassCoverErosionOutwardsWaveConditionsCalculationType.All) { exportableWaveConditions.AddRange( ExportableWaveConditionsFactory.CreateExportableWaveConditionsCollection( calculation.Name, calculation.InputParameters, calculation.Output.WaveImpactOutput, CoverType.GrassWaveImpact)); } + + if (calculationType == GrassCoverErosionOutwardsWaveConditionsCalculationType.TailorMadeWaveImpact || + calculationType == GrassCoverErosionOutwardsWaveConditionsCalculationType.WaveRunUpAndTailorMadeWaveImpact || + calculationType == GrassCoverErosionOutwardsWaveConditionsCalculationType.All) + { + exportableWaveConditions.AddRange( + ExportableWaveConditionsFactory.CreateExportableWaveConditionsCollection( + calculation.Name, calculation.InputParameters, calculation.Output.TailorMadeWaveImpactOutput, CoverType.GrassTailorMadeWaveImpact)); + } } return exportableWaveConditions; Index: Riskeer/GrassCoverErosionOutwards/test/Riskeer.GrassCoverErosionOutwards.IO.Test/Exporters/GrassCoverErosionOutwardsWaveConditionsExporterTest.cs =================================================================== diff -u -r0d37ff4d55947b639e1cf23227635245311ac751 -r00400ebd34caa40eeb3b9ccbf134628377e99225 --- Riskeer/GrassCoverErosionOutwards/test/Riskeer.GrassCoverErosionOutwards.IO.Test/Exporters/GrassCoverErosionOutwardsWaveConditionsExporterTest.cs (.../GrassCoverErosionOutwardsWaveConditionsExporterTest.cs) (revision 0d37ff4d55947b639e1cf23227635245311ac751) +++ Riskeer/GrassCoverErosionOutwards/test/Riskeer.GrassCoverErosionOutwards.IO.Test/Exporters/GrassCoverErosionOutwardsWaveConditionsExporterTest.cs (.../GrassCoverErosionOutwardsWaveConditionsExporterTest.cs) (revision 00400ebd34caa40eeb3b9ccbf134628377e99225) @@ -135,10 +135,10 @@ } [Test] - public void Export_ValidDataWithCalculationTypeBoth_ValidFile() + public void Export_ValidDataWithCalculationTypeWaveRunUpAndWaveImpact_ValidFile() { // Setup - string folderName = $"{nameof(GrassCoverErosionOutwardsWaveConditionsExporterTest)}.{nameof(Export_ValidDataWithCalculationTypeBoth_ValidFile)}"; + string folderName = $"{nameof(GrassCoverErosionOutwardsWaveConditionsExporterTest)}.{nameof(Export_ValidDataWithCalculationTypeWaveRunUpAndWaveImpact_ValidFile)}"; string directoryPath = TestHelper.GetScratchPadPath(folderName); using (new DirectoryDisposeHelper(TestHelper.GetScratchPadPath(), folderName)) { @@ -301,5 +301,176 @@ Assert.AreEqual(expectedText, fileContent); } } + + [Test] + public void Export_ValidDataWithCalculationTypeTailorMadeWaveImpact_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.TailorMadeWaveImpact + }, + Output = GrassCoverErosionOutwardsWaveConditionsOutputTestFactory.Create( + new[] + { + new TestWaveConditionsOutput() + }, 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 toets op maat), IVv, 1.10, 2.20, 3.30, 4.40, 5.50{Environment.NewLine}"; + Assert.AreEqual(expectedText, fileContent); + } + } + + [Test] + public void Export_ValidDataWithCalculationTypeWaveRunUpAndTailorMadeWaveImpact_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.WaveRunUpAndTailorMadeWaveImpact + }, + Output = GrassCoverErosionOutwardsWaveConditionsOutputTestFactory.Create( + new[] + { + new TestWaveConditionsOutput() + }, 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}" + + $"aCalculation, aLocation, 44.000, 123.456, foreshoreA, nee, nee, Gras (golfklap toets op maat), IVv, 1.10, 2.20, 3.30, 4.40, 5.50{Environment.NewLine}"; + Assert.AreEqual(expectedText, fileContent); + } + } + + [Test] + public void Export_ValidDataWithCalculationTypeAll_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.All + }, + Output = GrassCoverErosionOutwardsWaveConditionsOutputTestFactory.Create( + new[] + { + new TestWaveConditionsOutput() + }, 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}" + + $"aCalculation, aLocation, 44.000, 123.456, foreshoreA, nee, nee, Gras (golfklap), IVv, 1.10, 2.20, 3.30, 4.40, 5.50{Environment.NewLine}" + + $"aCalculation, aLocation, 44.000, 123.456, foreshoreA, nee, nee, Gras (golfklap toets op maat), 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/Revetment/src/Riskeer.Revetment.IO/Properties/Resources.resx =================================================================== diff -u -re7f106928d957ff6a4c163a9d3ab4eee5fd466a4 -r00400ebd34caa40eeb3b9ccbf134628377e99225 --- Riskeer/Revetment/src/Riskeer.Revetment.IO/Properties/Resources.resx (.../Resources.resx) (revision e7f106928d957ff6a4c163a9d3ab4eee5fd466a4) +++ Riskeer/Revetment/src/Riskeer.Revetment.IO/Properties/Resources.resx (.../Resources.resx) (revision 00400ebd34caa40eeb3b9ccbf134628377e99225) @@ -163,4 +163,7 @@ Gras (golfklap) + + Gras (golfklap toets op maat) + \ No newline at end of file Index: Riskeer/Revetment/src/Riskeer.Revetment.IO/WaveConditions/CoverType.cs =================================================================== diff -u -r6ffc82cdc65a7d06caf559bc04d059739fb59621 -r00400ebd34caa40eeb3b9ccbf134628377e99225 --- Riskeer/Revetment/src/Riskeer.Revetment.IO/WaveConditions/CoverType.cs (.../CoverType.cs) (revision 6ffc82cdc65a7d06caf559bc04d059739fb59621) +++ Riskeer/Revetment/src/Riskeer.Revetment.IO/WaveConditions/CoverType.cs (.../CoverType.cs) (revision 00400ebd34caa40eeb3b9ccbf134628377e99225) @@ -33,6 +33,7 @@ public static readonly CoverType Asphalt = new CoverType(Resources.CoverType_Asphalt); public static readonly CoverType GrassWaveRunUp = new CoverType(Resources.CoverType_GrassWaveRunUp); public static readonly CoverType GrassWaveImpact = new CoverType(Resources.CoverType_GrassWaveImpact); + public static readonly CoverType GrassTailorMadeWaveImpact = new CoverType(Resources.CoverType_GrassTailorMadeWaveImpact); private CoverType(string name) { Index: Riskeer/Revetment/test/Riskeer.Revetment.IO.Test/WaveConditions/CoverTypeTest.cs =================================================================== diff -u -re7f106928d957ff6a4c163a9d3ab4eee5fd466a4 -r00400ebd34caa40eeb3b9ccbf134628377e99225 --- Riskeer/Revetment/test/Riskeer.Revetment.IO.Test/WaveConditions/CoverTypeTest.cs (.../CoverTypeTest.cs) (revision e7f106928d957ff6a4c163a9d3ab4eee5fd466a4) +++ Riskeer/Revetment/test/Riskeer.Revetment.IO.Test/WaveConditions/CoverTypeTest.cs (.../CoverTypeTest.cs) (revision 00400ebd34caa40eeb3b9ccbf134628377e99225) @@ -61,5 +61,12 @@ // Assert Assert.AreEqual("Gras (golfklap)", CoverType.GrassWaveImpact.Name); } + + [Test] + public void Name_GrassTailorMadeWaveImpact_CorrectName() + { + // Assert + Assert.AreEqual("Gras (golfklap toets op maat)", CoverType.GrassTailorMadeWaveImpact.Name); + } } } \ No newline at end of file