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