Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Exporters/MacroStabilityInwardsCalculationGroupExporter.cs
===================================================================
diff -u -r9bb5d70c44fac8bdbb621c0c06b3f119bf7929e4 -r02bb3f034254e688fb76ea43a0be6c0d406a44d6
--- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Exporters/MacroStabilityInwardsCalculationGroupExporter.cs (.../MacroStabilityInwardsCalculationGroupExporter.cs) (revision 9bb5d70c44fac8bdbb621c0c06b3f119bf7929e4)
+++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Exporters/MacroStabilityInwardsCalculationGroupExporter.cs (.../MacroStabilityInwardsCalculationGroupExporter.cs) (revision 02bb3f034254e688fb76ea43a0be6c0d406a44d6)
@@ -149,8 +149,12 @@
var exporter = new MacroStabilityInwardsCalculationExporter(calculation, persistenceFactory, filePath, () => getNormativeAssessmentLevelFunc(calculation));
bool exportSucceeded = exporter.Export();
- if (!exportSucceeded)
+ if (exportSucceeded)
{
+ log.InfoFormat(Resources.MacroStabilityInwardsCalculationGroupExporter_Export_Data_from_0_exported_to_file_1, calculation.Name, filePath);
+ }
+ else
+ {
log.ErrorFormat("{0} {1}", string.Format(CoreCommonUtilResources.Error_General_output_error_0, filePath), Resources.MacroStabilityInwardsCalculationExporter_Export_no_stability_project_exported);
}
Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Properties/Resources.Designer.cs
===================================================================
diff -u -raf592f7409e88d522fad4ecd5fb8df24be19c00a -r02bb3f034254e688fb76ea43a0be6c0d406a44d6
--- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision af592f7409e88d522fad4ecd5fb8df24be19c00a)
+++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 02bb3f034254e688fb76ea43a0be6c0d406a44d6)
@@ -315,6 +315,16 @@
}
///
+ /// Looks up a localized string similar to Gegevens van '{0}' zijn geëxporteerd naar bestand '{1}'..
+ ///
+ public static string MacroStabilityInwardsCalculationGroupExporter_Export_Data_from_0_exported_to_file_1 {
+ get {
+ return ResourceManager.GetString("MacroStabilityInwardsCalculationGroupExporter_Export_Data_from_0_exported_to_file" +
+ "_1", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized string similar to De laag bevat een ongeldige geometrie..
///
public static string MacroStabilityInwardsSoilLayerTransformer_TransformSegmentToRing_Invalid_geometry_for_Ring {
Index: Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Properties/Resources.resx
===================================================================
diff -u -raf592f7409e88d522fad4ecd5fb8df24be19c00a -r02bb3f034254e688fb76ea43a0be6c0d406a44d6
--- Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Properties/Resources.resx (.../Resources.resx) (revision af592f7409e88d522fad4ecd5fb8df24be19c00a)
+++ Riskeer/MacroStabilityInwards/src/Riskeer.MacroStabilityInwards.IO/Properties/Resources.resx (.../Resources.resx) (revision 02bb3f034254e688fb76ea43a0be6c0d406a44d6)
@@ -223,4 +223,7 @@
Berekening '{0}' heeft geen uitvoer. Deze berekening wordt overgeslagen.
+
+ Gegevens van '{0}' zijn geëxporteerd naar bestand '{1}'.
+
\ No newline at end of file
Index: Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.IO.Test/Exporters/MacroStabilityInwardsCalculationGroupExporterTest.cs
===================================================================
diff -u -r9bb5d70c44fac8bdbb621c0c06b3f119bf7929e4 -r02bb3f034254e688fb76ea43a0be6c0d406a44d6
--- Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.IO.Test/Exporters/MacroStabilityInwardsCalculationGroupExporterTest.cs (.../MacroStabilityInwardsCalculationGroupExporterTest.cs) (revision 9bb5d70c44fac8bdbb621c0c06b3f119bf7929e4)
+++ Riskeer/MacroStabilityInwards/test/Riskeer.MacroStabilityInwards.IO.Test/Exporters/MacroStabilityInwardsCalculationGroupExporterTest.cs (.../MacroStabilityInwardsCalculationGroupExporterTest.cs) (revision 02bb3f034254e688fb76ea43a0be6c0d406a44d6)
@@ -287,6 +287,70 @@
}
[Test]
+ public void Export_CalculationGroupWithNestedGroupsAndCalculations_LogsMessages()
+ {
+ // Setup
+ string folderPath = TestHelper.GetScratchPadPath($"{nameof(MacroStabilityInwardsCalculationGroupExporterTest)}.{nameof(Export_CalculationGroupWithNestedGroupsAndCalculations_LogsMessages)}");
+ Directory.CreateDirectory(folderPath);
+
+ MacroStabilityInwardsCalculationScenario calculation1 = CreateCalculation("calculation1");
+ MacroStabilityInwardsCalculationScenario calculation2 = CreateCalculation("calculation2");
+ MacroStabilityInwardsCalculationScenario calculation3 = CreateCalculation("calculation3");
+ MacroStabilityInwardsCalculationScenario calculation4 = CreateCalculation("calculation4");
+
+ var rootCalculationGroup = new CalculationGroup();
+ var nestedGroup1 = new CalculationGroup
+ {
+ Name = "NestedGroup1"
+ };
+ var nestedGroup2 = new CalculationGroup
+ {
+ Name = "NestedGroup2"
+ };
+ nestedGroup2.Children.Add(calculation4);
+ nestedGroup1.Children.Add(calculation3);
+ nestedGroup1.Children.Add(nestedGroup2);
+ rootCalculationGroup.Children.Add(calculation1);
+ rootCalculationGroup.Children.Add(calculation2);
+ rootCalculationGroup.Children.Add(nestedGroup1);
+
+ var exporter = new MacroStabilityInwardsCalculationGroupExporter(rootCalculationGroup, new PersistenceFactory(), folderPath, fileExtension, c => AssessmentSectionTestHelper.GetTestAssessmentLevel());
+
+ try
+ {
+ using (new MacroStabilityInwardsCalculatorFactoryConfig())
+ {
+ // Call
+ var exportResult = false;
+ void Call() => exportResult = exporter.Export();
+
+ // Assert
+ string calculation1FilePath = Path.Combine(folderPath, $"{calculation1.Name}.{fileExtension}");
+ string calculation2FilePath = Path.Combine(folderPath, $"{calculation2.Name}.{fileExtension}");
+ string calculation3FilePath = Path.Combine(folderPath, nestedGroup1.Name, $"{calculation3.Name}.{fileExtension}");
+ string calculation4FilePath = Path.Combine(folderPath, nestedGroup1.Name, nestedGroup2.Name, $"{calculation4.Name}.{fileExtension}");
+
+ TestHelper.AssertLogMessagesAreGenerated(Call, new[]
+ {
+ $"Gegevens van '{calculation1.Name}' zijn geëxporteerd naar bestand '{calculation1FilePath}'.",
+ $"Gegevens van '{calculation2.Name}' zijn geëxporteerd naar bestand '{calculation2FilePath}'.",
+ $"Gegevens van '{calculation3.Name}' zijn geëxporteerd naar bestand '{calculation3FilePath}'.",
+ $"Gegevens van '{calculation4.Name}' zijn geëxporteerd naar bestand '{calculation4FilePath}'."
+ });
+ Assert.IsTrue(exportResult);
+ AssertCalculationExists(calculation1FilePath);
+ AssertCalculationExists(calculation2FilePath);
+ AssertCalculationExists(calculation3FilePath);
+ AssertCalculationExists(calculation4FilePath);
+ }
+ }
+ finally
+ {
+ Directory.Delete(folderPath, true);
+ }
+ }
+
+ [Test]
public void Export_CalculationGroupWithCalculationsWithSameName_WritesFilesAndReturnsTrue()
{
// Setup