public void Export_CalculationsWithoutOutput_FileWithOnlyHeader() { // Setup const string folderName = nameof(Export_CalculationsWithoutOutput_FileWithOnlyHeader); string directoryPath = TestHelper.GetScratchPadPath(folderName); using (new DirectoryDisposeHelper(TestHelper.GetScratchPadPath(), folderName)) { string filePath = Path.Combine(directoryPath, "test.csv"); var calculationsWithoutOutput = new[] { new GrassCoverErosionOutwardsWaveConditionsCalculation() }; var exporter = new GrassCoverErosionOutwardsWaveConditionsExporter(calculationsWithoutOutput, filePath, i => "1/100"); // 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; Doelkans [1/jaar]; Waterstand [m+NAP]; Golfhoogte (Hs) [m]; Golfperiode (Tp) [s]; Golfrichting t.o.v. dijknormaal [°]; Golfrichting t.o.v. Noord [°]{Environment.NewLine}"; Assert.AreEqual(expectedText, fileContent); } }
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, CalculationType = GrassCoverErosionOutwardsWaveConditionsCalculationType.All }, Output = GrassCoverErosionOutwardsWaveConditionsOutputTestFactory.Create( new[] { new TestWaveConditionsOutput() }, new[] { new TestWaveConditionsOutput() }, new[] { new TestWaveConditionsOutput() }) } }; var exporter = new GrassCoverErosionOutwardsWaveConditionsExporter(calculations, filePath, i => "1/100"); // 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; Doelkans [1/jaar]; 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); 1/100; 1.10; 2.20; 3.30; 4.40; 5.50{Environment.NewLine}" + $"aCalculation; aLocation; 44.000; 123.456; foreshoreA; nee; nee; Gras (golfklap); 1/100; 1.10; 2.20; 3.30; 4.40; 5.50{Environment.NewLine}" + $"aCalculation; aLocation; 44.000; 123.456; foreshoreA; nee; nee; Gras (golfklap met golfrichting); 1/100; 1.10; 2.20; 3.30; 4.40; 5.50{Environment.NewLine}"; Assert.AreEqual(expectedText, fileContent); } }